-
Notifications
You must be signed in to change notification settings - Fork 6
/
project_run.py
61 lines (53 loc) · 1.38 KB
/
project_run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import click
import mlrun
@click.command()
@click.option(
"--project-name",
required=True,
help="Specify the project name.",
)
@click.option(
"--workflow-name",
required=True,
help="Specify the workflow name.",
)
@click.option(
"--repo",
required=True,
help="The repo name.",
default="archive",
)
@click.option(
"--branch",
type=click.Choice(["development", "staging", "main"]
),
required=True,
help="Specify the branch - only relevant when using git source.",
default="development",
)
@click.option(
"--single-cluster-mode",
is_flag=True,
help="Specify whether the environments exist in the same cluster.",
default=False,
)
def main(
project_name: str, workflow_name: str, repo: str, branch: str, single_cluster_mode: bool
) -> None:
user_project = (
True if single_cluster_mode and branch in ["staging", "main"] else False
)
source = f"{repo}#{branch}"
print(f"Loading project {project_name} with source {source}")
project = mlrun.get_or_create_project(
name=project_name,
user_project=user_project,
parameters={
"source" : source,
"default_image" : "yonishelach/sagemaker-demo"
}
)
print(f"Running workflow {workflow_name}...")
project.run(name=workflow_name, dirty=True, watch=True)
if __name__ == "__main__":
main()