Class: Smplkit::Management::RunsNamespace
- Inherits:
-
Object
- Object
- Smplkit::Management::RunsNamespace
- Defined in:
- lib/smplkit/management/jobs.rb
Overview
mgmt.jobs.runs.* — read-only run history plus the cancel / rerun run actions.
Instance Method Summary collapse
-
#cancel(run_id) ⇒ Smplkit::Jobs::Run
Cancel a pending run.
-
#get(run_id) ⇒ Smplkit::Jobs::Run
Fetch a single run by id.
-
#initialize(api) ⇒ RunsNamespace
constructor
A new instance of RunsNamespace.
-
#list(job: nil, page_size: nil, after: nil) ⇒ Array<Smplkit::Jobs::Run>
List runs for the authenticated account, newest first.
-
#rerun(run_id) ⇒ Smplkit::Jobs::Run
Re-run a prior run, spawning a new
RERUNrun.
Constructor Details
#initialize(api) ⇒ RunsNamespace
Returns a new instance of RunsNamespace.
176 177 178 |
# File 'lib/smplkit/management/jobs.rb', line 176 def initialize(api) @api = api end |
Instance Method Details
#cancel(run_id) ⇒ Smplkit::Jobs::Run
Cancel a pending run.
211 212 213 214 |
# File 'lib/smplkit/management/jobs.rb', line 211 def cancel(run_id) resp = Smplkit::Jobs.call_api { @api.cancel_run(run_id) } Smplkit::Jobs::Run.from_resource(resp.data) end |
#get(run_id) ⇒ Smplkit::Jobs::Run
Fetch a single run by id.
202 203 204 205 |
# File 'lib/smplkit/management/jobs.rb', line 202 def get(run_id) resp = Smplkit::Jobs.call_api { @api.get_run(run_id) } Smplkit::Jobs::Run.from_resource(resp.data) end |
#list(job: nil, page_size: nil, after: nil) ⇒ Array<Smplkit::Jobs::Run>
List runs for the authenticated account, newest first. Cursor paginated (ADR-014): pass page_size and the after cursor from the prior page. Pass job to scope to a single job’s history.
188 189 190 191 192 193 194 195 196 |
# File 'lib/smplkit/management/jobs.rb', line 188 def list(job: nil, page_size: nil, after: nil) opts = {} opts[:filter_job] = job unless job.nil? opts[:page_size] = page_size unless page_size.nil? opts[:page_after] = after unless after.nil? resp = Smplkit::Jobs.call_api { @api.list_runs(opts) } (resp.data || []).map { |r| Smplkit::Jobs::Run.from_resource(r) } end |
#rerun(run_id) ⇒ Smplkit::Jobs::Run
Re-run a prior run, spawning a new RERUN run.
220 221 222 223 |
# File 'lib/smplkit/management/jobs.rb', line 220 def rerun(run_id) resp = Smplkit::Jobs.call_api { @api.rerun_run(run_id) } Smplkit::Jobs::Run.from_resource(resp.data) end |