Class: OodCore::Job::Adapter Abstract

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

Overview

This class is abstract.

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

Instance Method Summary collapse

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

Parameters:

  • id (#to_s)

    the id of the job

Raises:

  • (NotImplementedError)

    if subclass did not define #delete


84
85
86
# File 'lib/ood_core/job/adapter.rb', line 84

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

Parameters:

  • id (#to_s)

    the id of the job

Raises:

  • (NotImplementedError)

    if subclass did not define #hold


66
67
68
# File 'lib/ood_core/job/adapter.rb', line 66

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

Parameters:

  • id (#to_s)

    the id of the job

Returns:

  • (Info)

    information describing submitted job

Raises:

  • (NotImplementedError)

    if subclass did not define #info


47
48
49
# File 'lib/ood_core/job/adapter.rb', line 47

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

#info_allArray<Info>

This method is abstract.

Subclass is expected to implement #info_all

Retrieve info for all jobs from the resource manager

Returns:

  • (Array<Info>)

    information describing submitted jobs

Raises:

  • (NotImplementedError)

    if subclass did not define #info_all


38
39
40
# File 'lib/ood_core/job/adapter.rb', line 38

def info_all
  raise NotImplementedError, "subclass did not define #info_all"
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

Parameters:

  • id (#to_s)

    the id of the job

Raises:

  • (NotImplementedError)

    if subclass did not define #release


75
76
77
# File 'lib/ood_core/job/adapter.rb', line 75

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

Parameters:

  • id (#to_s)

    the id of the job

Returns:

Raises:

  • (NotImplementedError)

    if subclass did not define #status


57
58
59
# File 'lib/ood_core/job/adapter.rb', line 57

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 = job_adapter.submit(solver_script)
#=> "1234.server"

Submit job that depends on previous job

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

Parameters:

  • script (Script)

    script object that describes the script and attributes for the submitted job

  • after (#to_s, Array<#to_s>)

    this job may be scheduled for execution at any point after dependent jobs have started execution

  • afterok (#to_s, Array<#to_s>)

    this job may be scheduled for execution only after dependent jobs have terminated with no errors

  • afternotok (#to_s, Array<#to_s>)

    this job may be scheduled for execution only after dependent jobs have terminated with errors

  • afterany (#to_s, Array<#to_s>)

    this job may be scheduled for execution after dependent jobs have terminated

Returns:

  • (String)

    the job id returned after successfully submitting a job

Raises:

  • (NotImplementedError)

    if subclass did not define #submit


30
31
32
# File 'lib/ood_core/job/adapter.rb', line 30

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