Skip to content

Commit

Permalink
limit the number of actions, else we cause a thread overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Sep 18, 2023
1 parent f2a67c9 commit 0e93755
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pioreactor/actions/leader/experiment_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from pioreactor.whoami import get_unit_name
from pioreactor.whoami import UNIVERSAL_IDENTIFIER

ACTION_COUNT_LIMIT = 248


def execute_action(
unit: str,
Expand Down Expand Up @@ -129,6 +131,7 @@ def load_and_verify_profile_file(profile_filename: str) -> struct.Profile:
# TODO: things to check for:
# 1. Don't "stop" any *_automations
# 2. Don't change generic settings on *_controllers, (Ex: changing target temp on temp_controller is wrong)
# 3. Current limitation with this architecture. We can't create more than 248 threads.

# 1.
def check_for_not_stopping_automations(act):
Expand All @@ -154,6 +157,11 @@ def check_for_settings_change_on_controllers(act):
check_for_settings_change_on_controllers(act) for act in actions_per_job[control_type]
)

# 3.
assert (
sum(len(x) for x in actions_per_job.values()) < ACTION_COUNT_LIMIT
), "Too many actions. Must be less than 248. Contact the Pioreactor authors."

return profile


Expand Down Expand Up @@ -258,6 +266,7 @@ def execute_experiment_profile(profile_filename: str, dry_run: bool = False) ->
dry_run,
),
)
t.daemon = True
timers.append(t)

# process specific jobs
Expand Down

0 comments on commit 0e93755

Please sign in to comment.