Skip to content

Commit

Permalink
ping individual pioreactors (since the api does it anyways) and avoid…
Browse files Browse the repository at this point in the history
… huey workers stampeding over each other
  • Loading branch information
CamDavidsonPilon committed Jan 23, 2025
1 parent e4b86c0 commit 6e2f25b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### Upcoming

- experiment profiles start now use the unit_api directly. I think this mitigates the huey workers stampeding on each other when try to start many jobs.
- improved chart colors in the UI

### 25.1.21

#### Highlights
Expand Down Expand Up @@ -27,7 +32,7 @@
analyze Analyze the data from a calibration.
```
For example, to run a pump calibration, use `pio calibrations run --device media_pump`. View all your media pump calibrations with: `pio calibrations list --device media_pump`. And to duplicate a
For example, to run a pump calibration, use `pio calibrations run --device media_pump`. View all your media pump calibrations with: `pio calibrations list --device media_pump`.
- For now, the actual calibrations are the same protocol as before, but in the near future, we'll be updating them with new features. Adding this unified CLI and YAML format was the first step.
Expand Down
9 changes: 7 additions & 2 deletions pioreactor/actions/leader/experiment_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@
from pioreactor.logging import create_logger
from pioreactor.logging import CustomLogger
from pioreactor.pubsub import Client
from pioreactor.pubsub import patch_into
from pioreactor.pubsub import patch_into_leader
from pioreactor.utils import ClusterJobManager
from pioreactor.utils import managed_lifecycle
from pioreactor.utils.networking import resolve_to_address
from pioreactor.utils.timing import catchtime
from pioreactor.utils.timing import current_utc_timestamp
from pioreactor.whoami import get_assigned_experiment_name
from pioreactor.whoami import get_unit_name
from pioreactor.whoami import is_testing_env


BoolExpression = str | bool
Env = dict[str, Any]

Expand Down Expand Up @@ -278,6 +281,7 @@ def wrapped_execute_action(
def chain_functions(*funcs: Callable[[], None]) -> Callable[[], None]:
def combined_function() -> None:
for func in funcs:
time.sleep(0.01) # add a tiny sleep to avoid overloading webservers
func()

return combined_function
Expand Down Expand Up @@ -540,8 +544,9 @@ def _callable() -> None:
logger.info(f"Dry-run: Starting {job_name} on {unit} with options {options} and args {args}.")
else:
logger.debug(f"Starting {job_name} on {unit} with options {options} and args {args}.")
patch_into_leader(
f"/api/workers/{unit}/jobs/run/job_name/{job_name}/experiments/{experiment}",
patch_into(
resolve_to_address(unit),
f"/unit_api/jobs/run/job_name/{job_name}",
json={
"options": evaluate_options(options, env),
"env": {"JOB_SOURCE": "experiment_profile", "EXPERIMENT": experiment},
Expand Down

0 comments on commit 6e2f25b

Please sign in to comment.