Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next version #48

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 73 additions & 70 deletions developer-guide/20-User interface/02-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,79 @@ slug: /web-ui-api
### All endpoints

```
Endpoint Methods Rule
--------------------------------------- ------- -------------------------------------------------------------------------
able_to_install_plugins_from_ui GET /api/allow_ui_installs
create_or_update_new_calibrations PUT /api/calibrations
get_available_calibrations_type_by_unit GET /api/calibrations/<pioreactor_unit>
get_available_calibrations_of_type GET /api/calibrations/<pioreactor_unit>/<calibration_type>
get_calibration_by_name GET /api/calibrations/<pioreactor_unit>/<calibration_type>/<calibration_name>
patch_calibrations PATCH /api/calibrations/<pioreactor_unit>/<calibration_type>/<calibration_name>
get_current_calibrations_of_type GET /api/calibrations/<pioreactor_unit>/<calibration_type>/current
get_configs GET /api/configs
get_config GET /api/configs/<filename>
update_config PATCH /api/configs/<filename>
get_automation_contrib GET /api/contrib/automations/<automation_type>
get_charts_contrib GET /api/contrib/charts
create_experiment_profile POST /api/contrib/experiment_profiles
get_experiment_profiles GET /api/contrib/experiment_profiles
get_experiment_profile GET /api/contrib/experiment_profiles/<filename>
delete_experiment_profile DELETE /api/contrib/experiment_profiles/<filename>
get_job_contrib GET /api/contrib/jobs
get_experiments GET /api/experiments
create_experiment POST /api/experiments
delete_experiment DELETE /api/experiments/<experiment>
update_experiment PATCH /api/experiments/<experiment>
get_logs GET /api/experiments/<experiment>/logs
get_media_rates GET /api/experiments/<experiment>/media_rates
get_fallback_time_series GET /api/experiments/<experiment>/time_series/<data_source>/<column>
get_growth_rates GET /api/experiments/<experiment>/time_series/growth_rates
get_od_readings GET /api/experiments/<experiment>/time_series/od_readings
get_od_readings_filtered GET /api/experiments/<experiment>/time_series/od_readings_filtered
get_temperature_readings GET /api/experiments/<experiment>/time_series/temperature_readings
get_unit_labels GET /api/experiments/<experiment>/unit_labels
upsert_unit_labels PUT /api/experiments/<experiment>/unit_labels
get_logs_for_unit_and_experiment GET /api/experiments/<experiment>/units/<unit>/logs
get_list_of_workers_for_experiment GET /api/experiments/<experiment>/workers
add_worker_to_experiment PUT /api/experiments/<experiment>/workers
remove_workers_from_experiment DELETE /api/experiments/<experiment>/workers
remove_worker_from_experiment DELETE /api/experiments/<experiment>/workers/<pioreactor_unit>
stop_worker_in_experiment POST /api/experiments/<experiment>/workers/<worker>/stop
stop_all_in_experiment POST /api/experiments/<experiment>/workers/stop
get_experiments_worker_assignments GET /api/experiments/assignment_count
get_latest_experiment GET /api/experiments/latest
export_datasets POST /api/export_datasets
get_historical_config_for GET /api/historical_configs/<filename>
get_historical_media_used GET /api/historical_media
get_historical_organisms_used GET /api/historical_organisms
is_local_access_point_active GET /api/is_local_access_point_active
install_plugin POST /api/plugins/install
get_installed_plugins GET /api/plugins/installed
get_plugin GET /api/plugins/installed/<filename>
uninstall_plugin POST /api/plugins/uninstall
setup_worker_pioreactor POST /api/setup_worker_pioreactor
reboot_unit POST /api/units/<unit>/reboot
shutdown_unit POST /api/units/<unit>/shutdown
update_app POST /api/update_app
update_app_from_release_archive POST /api/update_app_from_release_archive
update_app_to_develop POST /api/update_app_to_develop
upload POST /api/upload
get_app_version GET /api/versions/app
get_ui_version GET /api/versions/ui
get_list_of_workers GET /api/workers
add_worker PUT /api/workers
delete_worker DELETE /api/workers/<pioreactor_unit>
get_worker GET /api/workers/<pioreactor_unit>
get_experiment_assignment_for_worker GET /api/workers/<pioreactor_unit>/experiment
change_worker_status PUT /api/workers/<pioreactor_unit>/is_active
run_job_on_unit PATCH /api/workers/<unit>/experiments/<experiment>/jobs/<job>/run
stop_job_on_unit PATCH /api/workers/<unit>/jobs/<job>/stop
get_workers_and_experiment_assignments GET /api/workers/assignments
static GET /static/<path:filename>

Endpoint Methods Rule
--------------------------------------- ----------- -------------------------------------------------------------------------
able_to_install_plugins_from_ui GET /api/allow_ui_installs
create_or_update_new_calibrations PUT /api/calibrations
get_available_calibrations_type_by_unit GET /api/calibrations/<pioreactor_unit>
get_available_calibrations_of_type GET /api/calibrations/<pioreactor_unit>/<calibration_type>
get_calibration_by_name GET /api/calibrations/<pioreactor_unit>/<calibration_type>/<calibration_name>
patch_calibrations PATCH /api/calibrations/<pioreactor_unit>/<calibration_type>/<calibration_name>
get_current_calibrations_of_type GET /api/calibrations/<pioreactor_unit>/<calibration_type>/current
get_custer_time GET /api/cluster_time
set_cluster_time POST /api/cluster_time
get_configs GET /api/configs
get_config GET /api/configs/<filename>
update_config PATCH /api/configs/<filename>
get_automation_contrib GET /api/contrib/automations/<automation_type>
get_charts_contrib GET /api/contrib/charts
create_experiment_profile POST /api/contrib/experiment_profiles
edit_experiment_profile PATCH /api/contrib/experiment_profiles
get_experiment_profiles GET /api/contrib/experiment_profiles
get_experiment_profile GET /api/contrib/experiment_profiles/<filename>
delete_experiment_profile DELETE /api/contrib/experiment_profiles/<filename>
get_job_contrib GET /api/contrib/jobs
get_experiments GET /api/experiments
create_experiment POST /api/experiments
delete_experiment DELETE /api/experiments/<experiment>
update_experiment PATCH /api/experiments/<experiment>
get_logs GET /api/experiments/<experiment>/logs
get_media_rates GET /api/experiments/<experiment>/media_rates
get_fallback_time_series GET /api/experiments/<experiment>/time_series/<data_source>/<column>
get_growth_rates GET /api/experiments/<experiment>/time_series/growth_rates
get_od_readings GET /api/experiments/<experiment>/time_series/od_readings
get_od_readings_filtered GET /api/experiments/<experiment>/time_series/od_readings_filtered
get_temperature_readings GET /api/experiments/<experiment>/time_series/temperature_readings
get_unit_labels GET /api/experiments/<experiment>/unit_labels
upsert_unit_labels PUT /api/experiments/<experiment>/unit_labels
get_list_of_workers_for_experiment GET /api/experiments/<experiment>/workers
add_worker_to_experiment PUT /api/experiments/<experiment>/workers
remove_workers_from_experiment DELETE /api/experiments/<experiment>/workers
remove_worker_from_experiment DELETE /api/experiments/<experiment>/workers/<pioreactor_unit>
stop_all_in_experiment POST /api/experiments/<experiment>/workers/stop
get_experiments_worker_assignments GET /api/experiments/assignment_count
get_latest_experiment GET /api/experiments/latest
export_datasets POST /api/export_datasets
get_historical_config_for GET /api/historical_configs/<filename>
get_historical_media_used GET /api/historical_media
get_historical_organisms_used GET /api/historical_organisms
is_local_access_point_active GET /api/is_local_access_point_active
install_plugin POST /api/plugins/install
get_installed_plugins GET /api/plugins/installed
get_plugin GET /api/plugins/installed/<filename>
uninstall_plugin POST /api/plugins/uninstall
reboot_unit POST /api/units/<pioreactor_unit>/reboot
shutdown_unit POST /api/units/<pioreactor_unit>/shutdown
update_app POST /api/update_app
update_app_from_release_archive POST /api/update_app_from_release_archive
update_app_to_develop POST /api/update_app_to_develop
upload POST /api/upload
get_app_version GET /api/versions/app
get_ui_version GET /api/versions/ui
get_list_of_workers GET /api/workers
add_worker PUT /api/workers
delete_worker DELETE /api/workers/<pioreactor_unit>
get_worker GET /api/workers/<pioreactor_unit>
get_experiment_assignment_for_worker GET /api/workers/<pioreactor_unit>/experiment
run_job_on_unit PATCH, POST /api/workers/<pioreactor_unit>/experiments/<experiment>/jobs/<job>/run
stop_job_on_unit PATCH /api/workers/<pioreactor_unit>/experiments/<experiment>/jobs/<job>/stop
update_job_on_unit PATCH /api/workers/<pioreactor_unit>/experiments/<experiment>/jobs/<job>/update
get_logs_for_unit_and_experiment GET /api/workers/<pioreactor_unit>/experiments/<experiment>/logs
stop_all_jobs_on_worker POST /api/workers/<pioreactor_unit>/experiments/<experiment>/stop
change_worker_status PUT /api/workers/<pioreactor_unit>/is_active
get_workers_and_experiment_assignments GET /api/workers/assignments
setup_worker_pioreactor POST /api/workers/setup
static GET /static/<path:filename>
```

From `python3 -m flask --debug --app main routes -s rule`
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,43 @@ common:
target_rpm: ${{ ::stirring:target_rpm + 10 * ::od_reading:od1.od }}
```

### The `when` action

The `when` action is used to trigger an actions(s) _the first time_ the condition is satisfied. For example, you could start a chemostat when the OD rises above a threshold, or turn off heating when the temperature exceed some threshold, or log a message when some condition is met.

The `when` action has a few required fields:

- `condition`: this is an expression (see above) that when evaluated to `true`, will execute the `actions`
- `actions`: this is a list of `actions` to run when the expression evaluates to true.

For example, the following section would start a chemostat when the OD reading is greater than 2.0 in all workers:

```yaml
common:
jobs:
od_reading:
actions:
- type: start
dosing_control:
actions:
- type: when
condition: ${{::od_reading:od1.od > 2.0}}
hours_elapsed: 0
actions:
- type: start
hours_elapsed: 0
options:
automation_name: chemostat
volume: 0.6
duration: 10


```

The `hours_elapsed` works like an other action: it'll only start to check after `hours_elapsed` hours have occurred since the start of execution.

After the condition is met, the actions run, and the condition is never checked again. The `when` is said to be _exhausted_.


### The `repeat` action

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ slug: /experiment-profiles-schema
---


Below is a schema for experiment profiles. We also do a run-time check
Below is a schema for experiment profiles. We also do a run-time check.

```yaml
# Main structure of the experiment profile
Expand All @@ -26,7 +26,7 @@ common:
jobs:
<job_name>:
actions:
- type: <string> # Type of action: "start", "pause", "resume", "stop", "update", or "log"
- type: <string> # Type of action: "start", "pause", "resume", "stop", "update", "repeat", "when", or "log"
hours_elapsed: <float> # Time when the action is scheduled (in hours after experiment start)
# Options for the action (optional)
# If type is 'log', a 'message' parameter is required here
Expand All @@ -44,7 +44,7 @@ pioreactors:
jobs:
<job_name>:
actions:
- type: <string> # Type of action: "start", "pause", "resume", "stop", or "update"
- type: <string> # Type of action: "start", "pause", "resume", "stop", "update", "repeat", "when", or "log"
hours_elapsed: <float> # Time when the action is scheduled (in hours after experiment start)
# Optional 'if' directive for conditional execution of actions
if: <string> # Can be an expression
Expand Down
Loading