|
19 | 19 | from pioreactor.experiment_profiles import profile_struct as struct |
20 | 20 | from pioreactor.logging import create_logger |
21 | 21 | from pioreactor.logging import CustomLogger |
| 22 | +from pioreactor import types as pt |
22 | 23 | from pioreactor.mureq import HTTPException |
23 | 24 | from pioreactor.pubsub import get_from |
24 | 25 | from pioreactor.pubsub import patch_into |
@@ -135,7 +136,7 @@ def check_syntax_of_bool_expression(bool_expression: BoolExpression) -> bool: |
135 | 136 | return check_syntax(bool_expression) |
136 | 137 |
|
137 | 138 |
|
138 | | -def check_if_job_running(unit: str, job: str) -> bool: |
| 139 | +def check_if_job_running(unit: pt.Unit, job: str) -> bool: |
139 | 140 | if is_testing_env(): |
140 | 141 | return True |
141 | 142 | try: |
@@ -197,8 +198,8 @@ def get_simple_priority(action: struct.Action): |
197 | 198 |
|
198 | 199 |
|
199 | 200 | def wrapped_execute_action( |
200 | | - unit: str, |
201 | | - experiment: str, |
| 201 | + unit: pt.Unit, |
| 202 | + experiment: pt.Experiment, |
202 | 203 | global_env: Env, |
203 | 204 | job_name: str, |
204 | 205 | logger: CustomLogger, |
@@ -322,7 +323,7 @@ def combined_function() -> None: |
322 | 323 |
|
323 | 324 |
|
324 | 325 | def common_wrapped_execute_action( |
325 | | - experiment: str, |
| 326 | + experiment: pt.Experiment, |
326 | 327 | job_name: str, |
327 | 328 | global_env: Env, |
328 | 329 | logger: CustomLogger, |
@@ -353,8 +354,8 @@ def common_wrapped_execute_action( |
353 | 354 |
|
354 | 355 |
|
355 | 356 | def when( |
356 | | - unit: str, |
357 | | - experiment: str, |
| 357 | + unit: pt.Unit, |
| 358 | + experiment: pt.Experiment, |
358 | 359 | parent_job: long_running_managed_lifecycle, |
359 | 360 | job_name: str, |
360 | 361 | dry_run: bool, |
@@ -431,8 +432,8 @@ def _callable() -> None: |
431 | 432 |
|
432 | 433 |
|
433 | 434 | def repeat( |
434 | | - unit: str, |
435 | | - experiment: str, |
| 435 | + unit: pt.Unit, |
| 436 | + experiment: pt.Experiment, |
436 | 437 | parent_job: long_running_managed_lifecycle, |
437 | 438 | job_name: str, |
438 | 439 | dry_run: bool, |
@@ -521,8 +522,8 @@ def _callable() -> None: |
521 | 522 |
|
522 | 523 |
|
523 | 524 | def log( |
524 | | - unit: str, |
525 | | - experiment: str, |
| 525 | + unit: pt.Unit, |
| 526 | + experiment: pt.Experiment, |
526 | 527 | parent_job: long_running_managed_lifecycle, |
527 | 528 | job_name: str, |
528 | 529 | dry_run: bool, |
@@ -565,8 +566,8 @@ def _callable() -> None: |
565 | 566 |
|
566 | 567 |
|
567 | 568 | def start_job( |
568 | | - unit: str, |
569 | | - experiment: str, |
| 569 | + unit: pt.Unit, |
| 570 | + experiment: pt.Experiment, |
570 | 571 | parent_job: long_running_managed_lifecycle, |
571 | 572 | job_name: str, |
572 | 573 | dry_run: bool, |
@@ -627,8 +628,8 @@ def _callable() -> None: |
627 | 628 |
|
628 | 629 |
|
629 | 630 | def pause_job( |
630 | | - unit: str, |
631 | | - experiment: str, |
| 631 | + unit: pt.Unit, |
| 632 | + experiment: pt.Experiment, |
632 | 633 | parent_job: long_running_managed_lifecycle, |
633 | 634 | job_name: str, |
634 | 635 | dry_run: bool, |
@@ -670,8 +671,8 @@ def _callable() -> None: |
670 | 671 |
|
671 | 672 |
|
672 | 673 | def resume_job( |
673 | | - unit: str, |
674 | | - experiment: str, |
| 674 | + unit: pt.Unit, |
| 675 | + experiment: pt.Experiment, |
675 | 676 | parent_job: long_running_managed_lifecycle, |
676 | 677 | job_name: str, |
677 | 678 | dry_run: bool, |
@@ -714,8 +715,8 @@ def _callable() -> None: |
714 | 715 |
|
715 | 716 |
|
716 | 717 | def stop_job( |
717 | | - unit: str, |
718 | | - experiment: str, |
| 718 | + unit: pt.Unit, |
| 719 | + experiment: pt.Experiment, |
719 | 720 | parent_job: long_running_managed_lifecycle, |
720 | 721 | job_name: str, |
721 | 722 | dry_run: bool, |
@@ -754,8 +755,8 @@ def _callable() -> None: |
754 | 755 |
|
755 | 756 |
|
756 | 757 | def update_job( |
757 | | - unit: str, |
758 | | - experiment: str, |
| 758 | + unit: pt.Unit, |
| 759 | + experiment: pt.Experiment, |
759 | 760 | parent_job: long_running_managed_lifecycle, |
760 | 761 | job_name: str, |
761 | 762 | dry_run: bool, |
@@ -855,7 +856,7 @@ def load_and_verify_profile(profile_filename: str) -> struct.Profile: |
855 | 856 | return profile |
856 | 857 |
|
857 | 858 |
|
858 | | -def push_labels_to_ui(experiment, labels_map: dict[str, str]) -> None: |
| 859 | +def push_labels_to_ui(experiment: pt.Experiment, labels_map: dict[str, str]) -> None: |
859 | 860 | try: |
860 | 861 | for unit_name, label in labels_map.items(): |
861 | 862 | patch_into_leader( |
@@ -912,7 +913,7 @@ def check_plugins(required_plugins: list[struct.Plugin]) -> None: |
912 | 913 | raise ImportError(f"Missing plugins: {not_installed}") |
913 | 914 |
|
914 | 915 |
|
915 | | -def execute_experiment_profile(profile_filename: str, experiment: str, dry_run: bool = False) -> None: |
| 916 | +def execute_experiment_profile(profile_filename: str, experiment: pt.Experiment, dry_run: bool = False) -> None: |
916 | 917 | unit = get_unit_name() |
917 | 918 | action_name = "experiment_profile" |
918 | 919 | with long_running_managed_lifecycle(unit, experiment, action_name) as mananged_job: |
@@ -1065,7 +1066,7 @@ def click_experiment_profile(): |
1065 | 1066 | @click.argument("filename", type=click.Path()) |
1066 | 1067 | @click.argument("experiment", type=str) |
1067 | 1068 | @click.option("--dry-run", is_flag=True, help="Don't actually execute, just print to screen") |
1068 | | -def click_execute_experiment_profile(filename: str, experiment: str, dry_run: bool) -> None: |
| 1069 | +def click_execute_experiment_profile(filename: str, experiment: pt.Experiment, dry_run: bool) -> None: |
1069 | 1070 | """ |
1070 | 1071 | (leader only) Run an experiment profile. |
1071 | 1072 | """ |
|
0 commit comments