core Package

firetask Module

TODO: add docs

class fireworks.core.firetask.FireTaskBase(parameters)

TODO: add docs

classmethod from_dict(m_dict)
run_task(fw)
to_dict(*args, **kwargs)

firework Module

A FireWork defines a workflow step.

An FWorkflow connects FireWorks by their fw_ids.

A Launch is a describes a FireWork’s run on a computing resource. The same Launch might apply to multiple FireWorks, e.g. if they are identical.

A FWDecision encapsulates the output of that launch.

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.FWorkflow(fireworks, wf_connections)
classmethod from_FireWork(fw)
classmethod from_tarfile(tar_filename)
to_db_dict()
to_tarfile(f_name='fwf.tar', f_format='json')
class fireworks.core.firework.FireWork(tasks, spec=None, fw_id=-1, launch_data=None, state='WAITING')

Bases: fireworks.utilities.fw_serializers.FWSerializable

classmethod from_dict(m_dict)
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, host=None, ip=None, launch_dir=None, start=None, end=None, state=None, launch_id=None)

Bases: fireworks.utilities.fw_serializers.FWSerializable

classmethod from_dict(m_dict)
time_secs
to_db_dict()
to_dict()
class fireworks.core.firework.WFConnections(child_nodes_dict=None)

Bases: fireworks.utilities.fw_serializers.FWSerializable

classmethod from_dict(m_dict)
to_db_dict()
to_dict()

fw_constants Module

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

fireworks.core.fw_constants.DATETIME_HANDLER(obj)

fworker Module

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

class fireworks.core.fworker.FWorker(name='anonymous worker', 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.QueueParams(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)

Given a FireWork id, give back a FireWork object :param fw_id: FireWork id (int)

get_fw_ids(query=None)

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

get_launches(fw_id)

Given a FireWork id, give back a FireWork object :param fw_id: FireWork id (int)

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!

insert_wf(fwf)
Parameters:fwf – an FWorkflow object.
to_dict()

Note: usernames/passwords are exported as unencrypted Strings!

queue_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.queue_launcher.launch_rocket(rocket_params, launcher_dir='.')

Submit a single job to the queue.

Parameters:
  • rocket_params – A RocketParams instance
  • launcher_dir – The directory where to submit the job
fireworks.core.queue_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

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)

fireworks.core.rocket.loop_rocket_run(launchpad, fworker, m_dir=None)

Keeps running Rockets in m_dir until we reach an error. Automatically creates subdirectories for each Rocket. Usually stops when we run out of FireWorks from the LaunchPad.

Parameters:
  • launchpad – a LaunchPad object
  • fworker – a FWorker object
  • m_dir – the directory in which to loop Rocket running

Table Of Contents

This Page