core Package

firetask Module

TODO: add docs

class fireworks.core.firetask.FireTaskBase(parameters)

TODO: add docs

classmethod from_dict(m_dict)
register_lp(launchpad)
run_task(fw)
to_dict(*args, **kwargs)
class fireworks.core.firetask.SubprocessTask(parameters)

Bases: fireworks.core.firetask.FireTaskBase, fireworks.utilities.fw_serializers.FWSerializable

classmethod from_str(shell_cmd)
run_task(fw)

firework Module

A FireWork defines a workflow as a DAG (directed acyclical graph).

A Launch is a describes a FireWork’s run on a computing resource.

class fireworks.core.firework.FWDecision(action, stored_data=None, mod_spec=None, add_fws=None)
A FWDecision returns one of several potential actions:
-CONTINUE means continue to the next stage in the workflow, no changes are made to the firework -BRANCH means to insert new Fireworks into the workflow and forget about the current children -DETOUR means to insert new Fireworks into the workflow, and then run the current children -TERMINATE means to terminate this branch of the workflow (any children of this Stage will NOT be run).

The output parameter is a dict that gets passed to the ‘output’ parameter of the LaunchInfo being analyzed. The output is a dict that:

  • stores any metadata about the decision
  • is used by Fuses of child FWs to determine how to proceed
actions = ['CONTINUE', 'BRANCH', 'DETOUR', 'TERMINATE']
classmethod from_dict(m_dict)
to_dict()
class fireworks.core.firework.FireWork(tasks, spec=None, fw_id=None, launch_data=None)

Bases: fireworks.utilities.fw_serializers.FWSerializable

classmethod from_dict(m_dict)
state

Iterate through the launch_data, and find the Launch that is furthest ahead. That is the state of the FireWork as a whole.

to_db_dict()

This is a ‘full’ dict representation of a FireWork. It contains redundant fields that enhance information retrieval.

to_dict()

This is a ‘minimal’ or ‘compact’ dict representation of the FireWork

class fireworks.core.firework.Launch(fworker, state=None, launch_id=None)

Bases: fireworks.utilities.fw_serializers.FWSerializable

classmethod from_dict(m_dict)
to_dict()

fw_constants Module

A set of global constants for FireWorks (Python code as a config file)

fworker Module

This module contains classes relevant for a FireWorker (worker computing resource)

class fireworks.core.fworker.FWorker(url='unknown url', category='general worker', query=None, params=None)

Bases: fireworks.utilities.fw_serializers.FWSerializable

classmethod from_dict(m_dict)
to_dict()
class fireworks.core.fworker.QueueAdapterBase

Bases: fireworks.utilities.fw_serializers.FWSerializable

The QueueAdapter is responsible for all interactions with a specific queue management system. This includes handling all details of queue script format as well as queue submission and management.

A user should extend this class with implementations that work on specific queue systems.

classmethod from_dict(m_dict)
get_njobs_in_queue(rocket_params, username=None)

returns the number of jobs in the queue, probably using subprocess or shutil to call a command like ‘qstat’. returns None when the number of jobs cannot be determined.

Parameters:
  • rocket_params – a RocketParams() instance
  • username – the username of the jobs to count (default is to autodetect)
get_script_str(rocket_params, launch_dir)

returns a (multi-line) String representing the queue script, e.g. PBS script. All details of the queue script must be specified in the RocketParams().

Parameters:
  • rocket_params – A RocketParams() instance
  • launch_dir – The directory the job will be launched in
submit_to_queue(rocket_params, script_file)

submits the job to the queue, probably using subprocess or shutil :param rocket_params: A RocketParams() instance :param script_file: name of the script file to use (String)

to_dict(*args, **kwargs)
class fireworks.core.fworker.RocketParams(queue_adapter, params, logging_dir='.')

Bases: fireworks.utilities.fw_serializers.FWSerializable

A RocketParams instance contains all the information needed to write a queue file and submit to a queue system. Details of the queue file format and queue submission commands should be included in the QueueAdapterBase object. Specific parameters used by the QueueAdapterBase should be included in the params variable.

classmethod from_dict(m_dict)

Note: The QueueAdapter is loaded based on its fw_name alone See the docs for to_dict() for more details

to_dict()

Note: the QueueAdapter is being serialized using the FW name alone This keeps the serialization compact and easy to edit by humans. The from_dict() will dynamically find the correct QueueAdapter using its fw_name.

launchpad Module

The LaunchPad manages the FireWorks database.

class fireworks.core.launchpad.LaunchPad(host='localhost', port=27017, name='fireworks', id_prefix=None, username=None, password=None)

Bases: fireworks.utilities.fw_serializers.FWSerializable

The LaunchPad manages the FireWorks database.

classmethod from_dict(d)
get_fw_by_id(fw_id, ignore_children=False)

Given a FireWork id, give back a FireWork object :param fw_id: FireWork id (int) :param ignore_children: if True, does not return parent or child FireWorks, just a single workflow step.

get_fw_ids(query=None)

Return all the fw ids that match a query :param query: a dict representing a Mongo query

get_new_fw_id()

Checkout the next FireWork id

get_new_launch_id()

Checkout the next Launch id

initialize(password, require_password=True)

Create a new FireWorks database. This will overwrite the existing FireWorks database! To safeguard against accidentally erasing an existing database, a password must be entered. :param password: A String representing today’s date, e.g. ‘2012-12-31’ :param require_password: Whether a password is required to initialize the DB. Highly recommended to leave this set to True, otherwise you are inviting dangerous behavior!

to_dict()

Note: usernames/passwords are exported as unencrypted Strings!

upsert_fw(fw)

Given a FireWork, either insert it into the database or update the FireWork with the same id.

Parameters:fw – A FireWork instance

rocket Module

TODO: add docs

class fireworks.core.rocket.Rocket(launchpad, fworker)

The Rocket fetches a workflow step from the FireWorks database and executes it.

run()

Run the rocket (actually check out a job from the database and execute it)

rocket_launcher Module

This module is used to submit jobs to a queue on a cluster. It can submit a single job, or if used in “rapid-fire” mode, can submit multiple jobs within a directory structure. The details of job submission and queue communication are handled using RocketParams, which specifies a QueueAdapter as well as desired properties of the submit script.

fireworks.core.rocket_launcher.launch_rocket(rocket_params, launch_dir='.')

Submit a single job to the queue.

Parameters:
  • rocket_params – A RocketParams instance
  • launch_dir – The directory where to submit the job
fireworks.core.rocket_launcher.rapid_fire(rocket_params, launch_dir='.', njobs_queue=10, njobs_block=500, n_loops=1, t_sleep=3600)

Submit many jobs to the queue.

Parameters:
  • rocket_params – A RocketParams instance
  • launch_dir – directory where we want to write the blocks
  • njobs_queue – stops submitting jobs when njobs_queue jobs are in the queue
  • njobs_block – automatically write a new block when njobs_block jobs are in a single block
  • n_loops – number of times to loop rapid-fire mode to maintain njobs_queue
  • t_sleep – sleep time between loops in rapid-fire mode

Table Of Contents

This Page