Telepath API
- class synmods.swarm.service.SwarmApi
Bases:
synapse.lib.stormsvc.StormSvc
,synapse.lib.cell.CellApi
A Telepath API for the Swarm service.
- async addJob(jdef, conf)
Add a new job definition and type specific config info. Note: It is a best practice for conf to be a dictionary.
- async addWork(jobid, data)
Add a work unit to the given jobid with the given data. Note: It is a best practice for data to be a dictionary.
- async cullJobs(state='complete', jobtype=None)
Cull jobs by state and jobtype.
- async cullRetnChan(chan, offs=None)
Empty but do not remove a return channel. If offs is specififed, cull up to (and including) the offset.
- async delJob(jobid)
Delete and cleanup the given jobid.
- async finiJobQueue(name)
Remove and clean up a jobtype work queue.
- async finiRetnChan(chan)
Remove a previously configured return channel.
- async getJob(jobid)
Return job definition and status info for the given jobid.
- async getJobConf(jobid)
Retrieve the type specific config info for the job.
- async getJobDef(jobid)
Return the job def for the given job id.
- async getNextWork(jobtype, timeout=60)
Retrieve the next work unit by type or None on timeout.
- async getWorkDef(workid)
Return the work def for the given workid.
- async initJobQueue(name, desc=None)
Initialize a jobtype and queue metadata.
- async initRetnChan(chan, desc=None)
Initialize a return channel by name.
Return channels are used to send the results of more than one job to a single consumer.
- async iterJobRetn(jobid, offs=0)
Yield (offs, workid, retn) tuples as work units complete.
- async iterJobs(state='running')
Yield job def dicts by state.
- Parameters
state (str or None) – Filter jobs by state, or yield all jobs if state=None.
- async iterJobsByTag(name, ival=None)
Yield job def dicts by tags.
- async iterRetnChan(chan, offs=0)
Yield (offs, workid, retn) tuples as work units complete.
- async setJobCancelled(jobid)
Set a running job to a cancelled state.
- async setJobFull(jobid)
A job is “full” once all of it’s work is loaded. Setting this allows a job to “complete” once all work is done.
- async setWorkDone(workid, retn)
Complete the given work unit setting retn. The retn tuple is (ok, valu).
- async statChanQueue(chan)
Return the status info for a given output channel.
- async statChanQueues()
Return a list of status info dicts for each channel.
- async statJobQueue(jobtype)
Return the status info for the jobtype work queue.
- async statJobQueues()
Return a list of status info dicts for each jobtype work queue.
- async statJobRetnQueues()
Return a summary of the total size and number of jobs in the job retn queue.