Skip to content
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

[Working POC] Working commit for spin #2335

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[Working POC] Working commit for spin #2335

wants to merge 2 commits into from

Conversation

talsperre
Copy link
Collaborator

This is a working version of spin. To use it simply run the following command:

python <my_flow.py> spin step_m --spin-pathspec <Full Task Pathspec>

You might have to run the flow once with this new commit, before being able to spin individual steps.

For instance,

python runtime_dag_flow.py spin step_m --spin-pathspec RuntimeDAGFlow/13/step_m/275233901

try:
spec = importlib.util.spec_from_file_location("artifacts_module", file_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like if there's arbitrary python code in the file, it will be executed here. Do we need to worry about that?

"--spin-pathspec",
default=None,
show_default=True,
help="Task ID to use when spinning up the step. The spun step will use the artifacts"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task id -> pathspec?

help="Change namespace from the default (your username) to the specified tag.",
)
@click.option(
"--skip-decorators/--no-skip-decorators",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe expose the decorator whitelist instead?

module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
variables = vars(module)
return variables
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't you check that ARTIFACTS exists here?

else:
# (Current task, "A:10,B:13,C:21") and (Parent task, "A:10,B:13")
# (Current task, "A:10,B:13") and (Parent task, "A:10,B:13")
if parent_step_type == "split-foreach":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move these strings into constants?

# Spin configuration
###
SPIN_ALLOWED_DECORATORS = from_conf(
"SPIN_ALLOWED_DECORATORS", ["conda", "pypi", "environment", "titus"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

titus probably shouldn't be in this repo

@@ -306,6 +385,40 @@ def __enter__(self) -> "Runner":
async def __aenter__(self) -> "Runner":
return self

def __get_executing_task(self, attribute_file_fd, command_obj):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type hints?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants