Class: Arcp::Job::Handle

Inherits:
Data
  • Object
show all
Defined in:
lib/arcp/job/handle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job_id:, agent:, submitted_at:, lease: nil, credentials: nil) ⇒ Handle

Returns a new instance of Handle.



6
7
8
# File 'lib/arcp/job/handle.rb', line 6

def initialize(job_id:, agent:, submitted_at:, lease: nil, credentials: nil)
  super
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent

Returns:

  • (Object)

    the current value of agent



5
6
7
# File 'lib/arcp/job/handle.rb', line 5

def agent
  @agent
end

#credentialsObject (readonly)

Returns the value of attribute credentials

Returns:

  • (Object)

    the current value of credentials



5
6
7
# File 'lib/arcp/job/handle.rb', line 5

def credentials
  @credentials
end

#job_idObject (readonly)

Returns the value of attribute job_id

Returns:

  • (Object)

    the current value of job_id



5
6
7
# File 'lib/arcp/job/handle.rb', line 5

def job_id
  @job_id
end

#leaseObject (readonly)

Returns the value of attribute lease

Returns:

  • (Object)

    the current value of lease



5
6
7
# File 'lib/arcp/job/handle.rb', line 5

def lease
  @lease
end

#submitted_atObject (readonly)

Returns the value of attribute submitted_at

Returns:

  • (Object)

    the current value of submitted_at



5
6
7
# File 'lib/arcp/job/handle.rb', line 5

def 
  @submitted_at
end

Instance Method Details

#cancel(client:, reason: nil) ⇒ Object



11
# File 'lib/arcp/job/handle.rb', line 11

def cancel(client:, reason: nil) = client.cancel_job(job_id: job_id, reason: reason)

#credential_for(endpoint:) ⇒ Object



13
# File 'lib/arcp/job/handle.rb', line 13

def credential_for(endpoint:) = Array(credentials).find { |credential| credential.endpoint == endpoint }

#get_result(client:) ⇒ Object



12
# File 'lib/arcp/job/handle.rb', line 12

def get_result(client:) = client.get_result(job_id: job_id)

#subscribe(client:, **kw) ⇒ Object



10
# File 'lib/arcp/job/handle.rb', line 10

def subscribe(client:, **kw) = client.subscribe_job(job_id: job_id, **kw)