fireworks.core.tests package — FireWorks 2.0.4 documentation

# fireworks.core.tests package

## Submodules

## fireworks.core.tests.tasks module

class fireworks.core.tests.tasks.DetoursTask(*args, **kwargs)

  Bases: `FiretaskBase`

  optional_params = ['n_detours', 'data_per_detour']
  run_task(fw_spec)

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

class fireworks.core.tests.tasks.DoNothingTask(*args, **kwargs)

  Bases: `FiretaskBase`

  run_task(fw_spec) → None

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

class fireworks.core.tests.tasks.ExceptionTestTask(*args, **kwargs)

  Bases: `FiretaskBase`

  exec_counter = 0
  run_task(fw_spec) → None

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

class fireworks.core.tests.tasks.ExecutionCounterTask(*args, **kwargs)

  Bases: `FiretaskBase`

  exec_counter = 0
  run_task(fw_spec) → None

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

class fireworks.core.tests.tasks.MalformedAdditionTask(*args, **kwargs)

  Bases: `FiretaskBase`

  run_task(fw_spec)

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

exception fireworks.core.tests.tasks.SerializableException(exc_details)

  Bases: `Exception`

  __init__(exc_details) → None
  to_dict()

class fireworks.core.tests.tasks.SlowAdditionTask(*args, **kwargs)

  Bases: `FiretaskBase`

  run_task(fw_spec)

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

class fireworks.core.tests.tasks.SlowToDictTask(*args, **kwargs)

  Bases: `FiretaskBase`

  run_task(fw_spec)

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

  to_dict()

class fireworks.core.tests.tasks.TodictErrorTask(*args, **kwargs)

  Bases: `FiretaskBase`

  run_task(fw_spec)

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

  to_dict() → NoReturn

class fireworks.core.tests.tasks.WaitWFLockTask(*args, **kwargs)

  Bases: `FiretaskBase`

  run_task(fw_spec)

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

## fireworks.core.tests.test_firework module

TODO: Modify unittest doc.

class fireworks.core.tests.test_firework.FiretaskBaseTest(methodName='runTest')

  Bases: `TestCase`

  test_init() → None
  test_param_checks() → None

class fireworks.core.tests.test_firework.FiretaskPickleTest(methodName='runTest')

  Bases: `TestCase`

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  test_init() → None

class fireworks.core.tests.test_firework.PickleTask(*args, **kwargs)

  Bases: `FiretaskBase`

  required_params = ['test']
  run_task(_fw_spec)

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

class fireworks.core.tests.test_firework.Task1(*args, **kwargs)

  Bases: `FiretaskBase`

  run_task(fw_spec)

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

class fireworks.core.tests.test_firework.Task2(*args, **kwargs)

  Bases: `FiretaskBase`

  run_task(fw_spec)

    This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.

    Parameters:

      fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.

    Returns:

      (FWAction)

class fireworks.core.tests.test_firework.TestLaunchRuntimeSecs

  Bases: `object`

  Tests for Launch.runtime_secs with mixed timezone datetimes.

  test_mixed_tz_datetimes(start_tz: timezone | None, end_tz: timezone | None) → None

    Handles mixed timezone-aware/naive datetimes without TypeError.

  test_none_when_incomplete() → None

    Returns None when launch hasn’t completed.

class fireworks.core.tests.test_firework.WorkflowTest(methodName='runTest')

  Bases: `TestCase`

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  test_copy() → None

    Test that we can produce a copy of a Workflow but that the copy has unique fw_ids.

  test_init() → None
  test_iter_len_index() → None
  test_remove_leaf_fws() → None
  test_remove_root_fws() → None

## fireworks.core.tests.test_launchpad module

class fireworks.core.tests.test_launchpad.AuthenticationTest(methodName='runTest')

  Bases: `TestCase`

  Tests whether users are authenticating against the correct mongo dbs.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  classmethod tearDownClass() → None

    Clean up the test user and database.

  test_authenticating_to_users_db() → None

    A user should be able to authenticate against a database that they are a user of.

  test_authsource_inferred_from_db_name() → None

    The default behavior is to authenticate against the db that the user is trying to access.

  test_no_admin_privileges_for_plebs() → None

    Normal users can not authenticate against the admin db.

class fireworks.core.tests.test_launchpad.GridfsStoredDataTest(methodName='runTest')

  Bases: `TestCase`

  Tests concerning the storage of data in Gridfs when the size of the documents exceed the 16MB limit.

  pytestmark = [Mark(name='mongodb', args=(), kwargs={})]
  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  tearDown() → None

    Hook method for deconstructing the test fixture after testing it.

  classmethod tearDownClass() → None

    Hook method for deconstructing the class fixture after running all tests in the class.

  test_many_detours() → None
  test_many_detours_offline() → None

class fireworks.core.tests.test_launchpad.LaunchPadDefuseReigniteRerunArchiveDeleteTest(methodName='runTest')

  Bases: `TestCase`

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  tearDown() → None

    Hook method for deconstructing the test fixture after testing it.

  classmethod tearDownClass() → None

    Hook method for deconstructing the class fixture after running all tests in the class.

  test_archive_wf() → None
  test_defuse_fw() → None
  test_defuse_fw_after_completion() → None
  test_defuse_wf() → None
  test_defuse_wf_after_partial_run() → None
  test_delete_wf() → None
  test_delete_wf_and_files() → None
  test_pause_fw() → None
  test_pause_wf() → None
  test_reignite_fw() → None
  test_reignite_wf() → None
  test_rerun_fws2() → None

class fireworks.core.tests.test_launchpad.LaunchPadLostRunsDetectTest(methodName='runTest')

  Bases: `TestCase`

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  tearDown() → None

    Hook method for deconstructing the test fixture after testing it.

  classmethod tearDownClass() → None

    Hook method for deconstructing the class fixture after running all tests in the class.

  test_detect_lostruns() → None
  test_detect_lostruns_defuse() → None
  test_state_after_run_start() → None

class fireworks.core.tests.test_launchpad.LaunchPadOfflineTest(methodName='runTest')

  Bases: `TestCase`

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  tearDown() → None

    Hook method for deconstructing the test fixture after testing it.

  classmethod tearDownClass() → None

    Hook method for deconstructing the class fixture after running all tests in the class.

  test__recover_completed() → None
  test_recover_errors() → None

class fireworks.core.tests.test_launchpad.LaunchPadRerunExceptionTest(methodName='runTest')

  Bases: `TestCase`

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  tearDown() → None

    Hook method for deconstructing the test fixture after testing it.

  classmethod tearDownClass() → None

    Hook method for deconstructing the class fixture after running all tests in the class.

  test_except_details_on_rerun() → None
  test_get_recovery_wrong_launch_id() → None
  test_task_level_rerun() → None
  test_task_level_rerun_cp() → None
  test_task_level_rerun_no_recovery_info() → None
  test_task_level_rerun_prev_dir() → None
  test_task_level_rerun_recover_launch_id() → None
  test_task_level_rerun_wrong_fw_id() → None
  test_task_level_rerun_wrong_launch_id() → None
  test_task_level_rerun_wrong_state() → None

class fireworks.core.tests.test_launchpad.LaunchPadTest(methodName='runTest')

  Bases: `TestCase`

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  tearDown() → None

    Hook method for deconstructing the test fixture after testing it.

  classmethod tearDownClass() → None

    Hook method for deconstructing the class fixture after running all tests in the class.

  test_add_wf() → None
  test_add_wfs() → None
  test_dict_from_file() → None
  test_pw_check() → None
  test_reset() → None

class fireworks.core.tests.test_launchpad.WFLockTest(methodName='runTest')

  Bases: `TestCase`

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  tearDown() → None

    Hook method for deconstructing the test fixture after testing it.

  classmethod tearDownClass() → None

    Hook method for deconstructing the class fixture after running all tests in the class.

  test_fix_db_inconsistencies_completed() → None
  test_fix_db_inconsistencies_fizzled() → None

class fireworks.core.tests.test_launchpad.WorkflowFireworkStatesTest(methodName='runTest')

  Bases: `TestCase`

  Class to test the firework states locally cached in workflow. The states have to be in sync with the actual firework state.

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  tearDown() → None

    Hook method for deconstructing the test fixture after testing it.

  classmethod tearDownClass() → None

    Hook method for deconstructing the class fixture after running all tests in the class.

  test_archive_wf() → None
  test_defuse_fw() → None
  test_defuse_fw_after_completion() → None
  test_defuse_wf() → None
  test_reignite_fw() → None
  test_reignite_wf() → None
  test_rerun_fws() → None
  test_rerun_timed_fws() → None

## fireworks.core.tests.test_rocket module

class fireworks.core.tests.test_rocket.RocketTest(methodName='runTest')

  Bases: `TestCase`

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  tearDown() → None

    Hook method for deconstructing the test fixture after testing it.

  classmethod tearDownClass() → None

    Hook method for deconstructing the class fixture after running all tests in the class.

  test_postproc_exception() → None
  test_serializable_exception() → None

## fireworks.core.tests.test_tracker module

Tracker unitest.

class fireworks.core.tests.test_tracker.TrackerTest(methodName='runTest')

  Bases: `TestCase`

  setUp() → None

    Hook method for setting up the test fixture before exercising it.

  classmethod setUpClass() → None

    Hook method for setting up class fixture before running tests in the class.

  tearDown() → None

    Hook method for deconstructing the test fixture after testing it.

  classmethod tearDownClass() → None

    Hook method for deconstructing the class fixture after running all tests in the class.

  test_tracker() → None

    Launch a workflow and track the files.

  test_tracker_failed_fw() → None

    Add a bad firetask to workflow and test the tracking.

  test_tracker_mlaunch() → None

    Test the tracker for mlaunch.

## Module contents