Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasFehring committed Apr 15, 2024
1 parent a3b44af commit cf83f99
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"grammarly.selectors": [
{
"language": "restructuredtext",
"scheme": "file"
}
],
}
32 changes: 32 additions & 0 deletions docs/source/usage/distributed_execution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,35 @@ Multiple ``experiment executer`` processes execute the experiments in parallel o
from py_experimenter.experimenter import PyExperimenter
experimenter.execute(experiment_function, max_experiments=1)
Add Experiment and Execute
--------------------------

When executing jobs on clusters one might want to use `hydra submitit <https://hydra.cc/docs/plugins/submitit_launcher/>` or a similar software that configures different jobs. If so it makes sense to create the database initially

.. code-block:: python
...
experimenter = PyExperimenter(
experiment_configuration_file_path = "path/to/file",
database_credential_file_path = "path/to/file"
)
experimenter.create_table()
and then add the configured experiments experiments in the worker job, followed by an immediate execution.

.. code-block:: python
def _experiment_function(keyfields: dict, result_processor: ResultProcessor, custom_fields: dict):
...
...
@hydra.main(config_path="config", config_name="hydra_configname", version_base="1.1")
def experiment_wrapepr(config: Configuration):
...
experimenter = PyExperimenter(
experiment_configuration_file_path = "some/value/from/config",
database_credential_file_path = "path/to/file"
)
experimenter.add_experiment_and_execute(keyfield_values_from_config, _experiment_function)

0 comments on commit cf83f99

Please sign in to comment.