rocketsled.tests package

Submodules

rocketsled.tests.deserialize_func module

Auxiliary file for testing utils.

rocketsled.tests.deserialize_func.obj_func(x)

Objective function which sums the elements in x.

Args:

x ([float] or [int]): List of numbers to sum.

Returns:

y (float or int): The sum of x.

rocketsled.tests.test_task module

A file for testing the workflow capabilities of OptTask and MissionControl.

Note that a local mongod instance in admin mode must be running for the tests to pass by default.

WARNING: Tests reset the launchpad you specify. Specify a launchpad for testing you wouldn’t mind resetting (e.g., mlab.com) Modify tests_launchpad.yaml to define the db where you’d like to run the tests if you do not have access to admin mongod privledges on your local machine.

class rocketsled.tests.test_task.AccuracyTask(*args, **kwargs)

Bases: fireworks.core.firework.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.

Args:
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 rocketsled.tests.test_task.BasicTestTask(*args, **kwargs)

Bases: fireworks.core.firework.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.

Args:
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 rocketsled.tests.test_task.MultiTestTask(*args, **kwargs)

Bases: fireworks.core.firework.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.

Args:
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 rocketsled.tests.test_task.TestWorkflows(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_accuracy()
test_acqfuncs()
test_alternate_builtin_predictor()
test_basic()
test_batch()
test_complex()
test_custom_predictor()
test_duplicates()
test_get_z()
test_missioncontrol()
test_multi()
test_parallel()
rocketsled.tests.test_task.custom_predictor(*args, **kwargs)
rocketsled.tests.test_task.custom_predictor_batch(XZ_explored, Y, x_dims, XZ_unexplored, batch_size=1)

Testin a custom predictor function for a batch optimization.

Just uses a random sample of the unexplored space to return batch_size predictions.

Args:

XZ_explored: Y: x_dims: XZ_unexplored: batch_size:

Returns:

(list): ([3-dim array] * batch size) guesses.

rocketsled.tests.test_task.get_z(x)
rocketsled.tests.test_task.wf_creator_accuracy(x)

An expensive test ensuring the default predictor actually performs better than the average random case on the function defined in AccuracyTask.

rocketsled.tests.test_task.wf_creator_basic(x)

Testing a basic workflow with one Firework, and two FireTasks.

rocketsled.tests.test_task.wf_creator_batch(x)
rocketsled.tests.test_task.wf_creator_complex(x)

Testing a custom workflow of five fireworks with complex dependencies, and optimization in the middle. This “complex” Workflow has the form:

fw0 / fw1 fw2

/ fw3 (optimization)


fw4

fw5

rocketsled.tests.test_task.wf_creator_multiobjective(x)

Testing a multiobjective optimization.

rocketsled.tests.test_utils module

Testing utility functions in rocketsled

class rocketsled.tests.test_utils.TestUtilities(methodName='runTest')

Bases: unittest.case.TestCase

test_Dtypes()
test_check_dims()
test_convert_native()
test_convert_value_to_native()
test_deserialize()
test_get_default_opttask_kwargs()
test_get_len()
test_is_discrete()
test_latex_float()
test_pareto()
test_random_guess()
test_serialize()
test_split_xz()
test_tolerance_check()

Module contents