Class: OodJob::Adapter Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/ood_job/adapter.rb

Overview

This class is abstract.

A class that handles the communication with a resource manager for submitting/statusing/holding/deleting jobs

Direct Known Subclasses

OodJob::Adapters::Torque

Defined Under Namespace

Classes: Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster:, **_) ⇒ Adapter


14
15
16
# File 'lib/ood_job/adapter.rb', line 14

def initialize(cluster:, **_)
  @cluster = cluster
end

Instance Attribute Details

#clusterOodCluster::Cluster (readonly)

The cluster used in submitting, querying status, and controlling jobs


11
12
13
# File 'lib/ood_job/adapter.rb', line 11

def cluster
  @cluster
end

Instance Method Details

#delete(id:) ⇒ void

This method is abstract.

Subclass is expected to implement #delete

This method returns an undefined value.

Delete the submitted job

Raises:

  • (NotImplementedError)

    if subclass did not define #delete


88
89
90
# File 'lib/ood_job/adapter.rb', line 88

def delete(id:)
  raise NotImplementedError, "subclass did not define #delete"
end

#hold(id:) ⇒ void

This method is abstract.

Subclass is expected to implement #hold

This method returns an undefined value.

Put the submitted job on hold

Raises:

  • (NotImplementedError)

    if subclass did not define #hold


70
71
72
# File 'lib/ood_job/adapter.rb', line 70

def hold(id:)
  raise NotImplementedError, "subclass did not define #hold"
end

#info(id: '') ⇒ Info+

This method is abstract.

Subclass is expected to implement #info

Retrieve job info from the resource manager

Raises:

  • (NotImplementedError)

    if subclass did not define #info


51
52
53
# File 'lib/ood_job/adapter.rb', line 51

def info(id: '')
  raise NotImplementedError, "subclass did not define #info"
end

#release(id:) ⇒ void

This method is abstract.

Subclass is expected to implement #release

This method returns an undefined value.

Release the job that is on hold

Raises:

  • (NotImplementedError)

    if subclass did not define #release


79
80
81
# File 'lib/ood_job/adapter.rb', line 79

def release(id:)
  raise NotImplementedError, "subclass did not define #release"
end

#status(id:) ⇒ Status

This method is abstract.

Subclass is expected to implement #status

Note:

Optimized slightly over retrieving complete job information from server

Retrieve job status from resource manager

Raises:

  • (NotImplementedError)

    if subclass did not define #status


61
62
63
# File 'lib/ood_job/adapter.rb', line 61

def status(id:)
  raise NotImplementedError, "subclass did not define #status"
end

#submit(script:, after: [], afterok: [], afternotok: [], afterany: []) ⇒ String

This method is abstract.

Subclass is expected to implement #submit

Submit a job with the attributes defined in the job template instance

Examples:

Submit job template to cluster

solver_id = OodJob::Job.submit(script: solver_script)
#=> "1234.server"

Submit job that depends on previous job

post_id = OodJob::Job.submit(
  script: post_script,
  afterok: solver_id
)
#=> "1235.server"

Raises:

  • (NotImplementedError)

    if subclass did not define #submit


41
42
43
# File 'lib/ood_job/adapter.rb', line 41

def submit(script:, after: [], afterok: [], afternotok: [], afterany: [])
  raise NotImplementedError, "subclass did not define #submit"
end