-
Notifications
You must be signed in to change notification settings - Fork 787
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
Unbounded foreach #450
Closed
Closed
Unbounded foreach #450
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# This module provides a global singleton `cli_args` which stores the `top` and | ||
# `step` level options for the metaflow CLI. | ||
# This allows decorators to have access to the CLI options instead of relying | ||
# (solely) on the click context. | ||
# TODO(crk): Fold `dict_to_cli_options` as a private method of this `CLIArgs` | ||
# once all other callers of `step` [titus, meson etc.] are unified. | ||
from .util import dict_to_cli_options | ||
|
||
class CLIArgs(object): | ||
def __init__(self): | ||
self._top_kwargs = {} | ||
self._step_kwargs = {} | ||
|
||
def _set_step_kwargs(self, kwargs): | ||
self._step_kwargs = kwargs | ||
|
||
def _set_top_kwargs(self, kwargs): | ||
self._top_kwargs = kwargs | ||
|
||
@property | ||
def top_kwargs(self): | ||
return self._top_kwargs | ||
|
||
@property | ||
def step_kwargs(self): | ||
return self._step_kwargs | ||
|
||
def step_command(self, | ||
executable, | ||
script, | ||
step_name, | ||
top_kwargs=None, | ||
step_kwargs=None): | ||
cmd = [executable, '-u', script] | ||
if top_kwargs is None: | ||
top_kwargs = self._top_kwargs | ||
if step_kwargs is None: | ||
step_kwargs = self._step_kwargs | ||
|
||
top_args_list = [arg for arg in dict_to_cli_options(top_kwargs)] | ||
cmd.extend(top_args_list) | ||
cmd.extend(['step', step_name]) | ||
step_args_list = [arg for arg in dict_to_cli_options(step_kwargs)] | ||
cmd.extend(step_args_list) | ||
|
||
return cmd | ||
|
||
cli_args = CLIArgs() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,8 @@ def _merge_lists(base, overrides, attr): | |
from .aws.batch.batch_decorator import BatchDecorator, ResourcesDecorator | ||
from .aws.step_functions.step_functions_decorator import StepFunctionsInternalDecorator | ||
from .conda.conda_step_decorator import CondaStepDecorator | ||
from .test_unbounded_foreach.test_unbounded_foreach_decorator\ | ||
import TestUnboundedForeachDecorator | ||
|
||
STEP_DECORATORS = _merge_lists([CatchDecorator, | ||
TimeoutDecorator, | ||
|
@@ -61,7 +63,8 @@ def _merge_lists(base, overrides, attr): | |
RetryDecorator, | ||
BatchDecorator, | ||
StepFunctionsInternalDecorator, | ||
CondaStepDecorator], ext_plugins.STEP_DECORATORS, 'name') | ||
CondaStepDecorator, | ||
TestUnboundedForeachDecorator], ext_plugins.STEP_DECORATORS, 'name') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should expose this decorator right now. |
||
|
||
# Add Conda environment | ||
from .conda.conda_environment import CondaEnvironment | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
from metaflow.datastore import FlowDataStore | ||
from metaflow.datastore.local_backend import LocalBackend | ||
from metaflow.metaflow_config import DATASTORE_LOCAL_DIR | ||
from metaflow.unbounded_foreach import UBF_CONTROL, UBF_TASK | ||
from metaflow import util | ||
from metaflow import R | ||
from metaflow.exception import ( | ||
|
@@ -154,6 +155,11 @@ def kill(ctx, run_id, user, my_runs): | |
@click.option("--shared_memory", help="Shared Memory requirement for AWS Batch.") | ||
@click.option("--max_swap", help="Max Swap requirement for AWS Batch.") | ||
@click.option("--swappiness", help="Swappiness requirement for AWS Batch.") | ||
@click.option('--ubf-context', | ||
default=None, | ||
type=click.Choice([None, UBF_CONTROL, UBF_TASK]), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems to be a discrepancy between the 'none' option in cli.py and None here. Is this intended? |
||
help="Provides additional context if it belongs to an unbounded " | ||
"foreach.") | ||
@click.pass_context | ||
def step( | ||
ctx, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment not relevant to OSS or at least needs to be modded to remove irrelevant references.