Managing projects¶
The projects module defines the Project
class, which stores information
about a computation-based project and contains a number of methods for managing
and running computational experiments, whether simulations, analyses or
whatever. This is the main class that is used directly when using Sumatra within
your own scripts.
-
class
sumatra.projects.
Project
(name, default_executable=None, default_repository=None, default_main_file=None, default_launch_mode=None, data_store='default', record_store='default', on_changed='error', description='', data_label=None, input_datastore=None, label_generator='timestamp', timestamp_format='%Y%m%d-%H%M%S', allow_command_line_parameters=True)¶ Bases:
object
-
add_comment
(label, comment, replace=False)¶
-
add_record
(record)¶ Add a simulation or analysis record.
-
add_tag
(label, tag)¶
-
backup
()¶ Create a new backup directory in the same location as the project directory and copy the contents of the project directory into the backup directory. Uses _get_project_file to extract the path to the project directory.
Returns: - backup_dir: the directory used for the backup
-
change_record_store
(new_store)¶ Change the record store that is used by this project.
-
compare
(label1, label2, ignore_mimetypes=[], ignore_filenames=[])¶
-
data_label
¶
-
delete_by_tag
(tag, delete_data=False)¶ Delete all records with a given tag. Return the number of records deleted.
-
delete_record
(label, delete_data=False)¶ Delete a record. Return 1 if the record is found. Otherwise return 0.
-
export
()¶
-
format_records
(format='text', mode='short', tags=None, reverse=False)¶
-
get_record
(label)¶ Search for a record with the supplied label and return it if found. Otherwise return None.
-
info
()¶ Show some basic information about the project.
-
launch
(parameters={}, input_data=[], script_args='', executable='default', repository='default', main_file='default', version='current', launch_mode='default', label=None, reason=None, timestamp_format='default', repeats=None)¶ Launch a new simulation or analysis.
-
most_recent
()¶
-
new_record
(parameters={}, input_data=[], script_args='', executable='default', repository='default', main_file='default', version='current', launch_mode='default', label=None, reason=None, timestamp_format='default')¶
-
remove_tag
(label, tag)¶
-
repeat
(original_label, new_label=None)¶
-
save
()¶ Save state to some form of persistent storage. (file, database).
-
show_diff
(label1, label2, mode='short', ignore_mimetypes=[], ignore_filenames=[])¶
-
update_code
(working_copy, version='current')¶ Check if the working copy has modifications and prompt to commit or revert them.
-
valid_name_pattern
= '(?P<project>\\w+[\\w\\- ]*)'¶
-
-
sumatra.projects.
load_project
(path=None)¶ Read project from directory passed as the argument and return Project object. If no argument is given, the project is read from the current directory.