4.6.2. basf2.pickle_path - Functions necessary to pickle and unpickle a Path

This module contains all the functiones necessary to serialize and deserialize a full path with all modules, parameters, sub paths, conditions and so on. This can be used in conjunction with basf2 --dump-path and basf2 --execute-path to save a full configuration to file and execute it later.

basf2.pickle_path.check_pickle_path(path)[source]

Check if the path to be executed should be pickled or unpickled. This function is used by basf2.process to handle the --dump-path and --execute-path arguments to basf2

basf2.pickle_path.deserialize_conditions(module, module_state)[source]

Deserialize all conditions for a given basf2 module

basf2.pickle_path.deserialize_module(module_state)[source]

Deserialize a basf2 module from a python dictionary

basf2.pickle_path.deserialize_path(path_state)[source]

Deserialize a basf2 Path from a python dictionary

basf2.pickle_path.deserialize_value(module, parameter_state)[source]

Deserialize a single basf2 module paramater

basf2.pickle_path.get_path_from_file(path_filename)[source]

Read a path from a given pickle file

basf2.pickle_path.make_code_pickable(code)[source]

Sometimes it is necessary to execute code which won’t be pickled if a user dumps the basf2 path and wants to execute it later. Using the pickable_basf2 module all calls to basf2 functions are recorded. Now if a user has to execute code outside of basf2, e.g. modifying objects in the ROOT namespace, this won’t be pickled. By wrapping the code in this function it is technically a call to a basf2 function and will be pickled again. Problem solved.

basf2.pickle_path.serialize_conditions(module)[source]

Serialize all conditions attached to a basf2 module

basf2.pickle_path.serialize_module(module)[source]

Serialize a basf2 module into a python dictionary. Doesn’t work for python modules

basf2.pickle_path.serialize_path(path)[source]

Serialize a basf2 Path into a python dictionary

basf2.pickle_path.serialize_value(module, parameter)[source]

Serialize a single basf2 module parameter

basf2.pickle_path.write_path_to_file(path, filename)[source]

Write a path to a given pickle file