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.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.write_path_to_file(path, filename)[source]

Write a path to a given pickle file