Skip to content

Commit

Permalink
Move mechanism list out of class
Browse files Browse the repository at this point in the history
  • Loading branch information
gtopper committed Dec 8, 2024
1 parent c25e236 commit 833ac1e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions storey/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,9 @@ def __init__(self, runnable_name: str, data: Any, runtime: float):
self.runtime = runtime


parallel_execution_mechanisms = ("multiprocessing", "threading", "asyncio", "naive")


class ParallelExecutionRunnable:
"""
Runnable to be run by a ParallelExecution step. Subclasses must assign execution_mechanism with one of:
Expand All @@ -1466,11 +1469,10 @@ class ParallelExecutionRunnable:
"""

execution_mechanism: Optional[str] = None
supported_mechanisms = ("multiprocessing", "threading", "asyncio", "naive")

# ignore unused keyword arguments such as context which may be passed in by mlrun
def __init__(self, name: str, **kwargs):
if self.execution_mechanism not in self.supported_mechanisms:
if self.execution_mechanism not in parallel_execution_mechanisms:
raise ValueError(
"ParallelExecutionRunnable's execution_mechanism attribute must be overridden with one of: "
'"multiprocessing", "threading", "asyncio", "naive"'
Expand Down

0 comments on commit 833ac1e

Please sign in to comment.