Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose: While operation several scripts and running conditions are set. Usually we keep track of the settings, scripts etc in an ELOG. However figuring out the exact start and end of such a script from an ELOG and the database can be difficult.
Therefore we implement a run state service.
The run state is defined by
In a setup with multiple user it is important that not two users run a run script concurrently. Therefore, the run is active variable can indicate if a script is already running and if it is okay to start a new run.
The RunStateService containing a state dict with these three properties. The state is saved locally in a file to continue even if the container goes down.
Runs can e.g. be started with the dl-agent and returns the run number of the started run.
dl-agent -b rabbit-broker cmd run_state -s start_run "Test Run"The run can be stopped with the dl-agent and returns the run number of the stopped run.
dl-agent -b rabbit-broker cmd run_state -s stop_runEndpoints can be defined to get the individual parameters of the state dict via the StateGetEntity.
An example config file for the service is attached.
This service is especially good to use in python scripts using the dripline.core.interface