Batch Simulation Execution & Management (fixie_batch.simulations)

Tools for spawning, canceling, and querying cyclus simulations. Simulations are spawned detached from the parent process. All information about running processes is stored on the file system. These tools should be robust to the server or other managing process going down.

fixie_batch.simulations.cancel(job, user, token, project='')[source]

Cancels a job that is queued or running.

Parameters:

job : int or str

If an integer, this is the jobid. If it is a string, it is interpreted as a job name, and a jobid is looked up via the aliases cache.

user : str

Name of the user

token : str

Credential token for the user

project : str, optional

Name of the project, default ‘’, only used with alias lookup.

Returns:

jobid : int

Unique job id of the canceled run, this is negative if a unique jobid could not be found.

status : bool

Whether run was successfully canceled.

message : str

Message about status

fixie_batch.simulations.canceled_ids()

Set of canceled jobids.

fixie_batch.simulations.completed_ids()

Set of completed jobids.

fixie_batch.simulations.failed_ids()

Set of failed jobids.

fixie_batch.simulations.query(statuses='all', users=None, jobs=None, projects=None)[source]

Returns the state of the jobs, filtered as approriate.

Parameters:

statuses : str or set of str, optional

Which queue statuses we should pull jobs from. If ‘all’, every status queue is searched. If a set of str is provided, the statuses are ORed together.

users : str, set of str, or None, optional

User name(s) to filter on. If None, all user names are used. User names are ORed together, if multiple are provided.

jobs : int, str, set of ints & strs, or None, optional

The jobids and job names to filter on, if provided. If None, filtering on job id/name is not done. These are ORed together.

projects : str, set of str, or None, optional

Project names to filer on, if not None. These are ORed together.

Returns:

data : list of dicts or None

The list of all jobs found. None if status is False.

status : bool

Whether or not the query was successful.

message : str

Message related to the status of the query

fixie_batch.simulations.queued_ids()

Set of queued jobids.

fixie_batch.simulations.running_ids()

Set of running jobids.

fixie_batch.simulations.spawn(simulation, user, token, name='', project='', path='', permissions='public', post=(), notify=(), interactive=False, return_pid=False)[source]

Spawning simulations let’s the batch execution service know to run a simulation as soon as possible.

Parameters:

simulation : dict or string

Cyclus simulation, currently only dict methods are supported

user : str

Name of the user

token : str

Credential token for the user

name : str, optional

Alias for simulation, default ‘’

project : str, optional

Name of the project, default ‘’

path : str, optional

Path to suggest for output file. An empty string will apply a default path name, which depends on the simulation name, the project name, and the jobid.

permissions : str or list of str, optional

“public” (default), “private”, or a list of users. Currently only public permissions are supported.

post : list, optional

Any post processing activities, not currently supported

notify : list, optional

Any notifications to register, not currently supported

interactive : bool, optional

True or False (default), not currently supported.

return_pid : bool, optional

Whether or not to return the PID of the detached child process. Default False, this is mostly for testing.

Returns:

jobid : int

Unique job id of this run, this is negative if job could not be spawned.

status : bool

Whether run was spawned successfully,

message : str

Message about status

pid : int, if return_pid is True

Child process id.