-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdeploy.py
33 lines (30 loc) · 974 Bytes
/
deploy.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
import logging, os, argparse
from servicefoundry import Build, Job, PythonBuild, Param, Port, LocalSource, Resources
# parsing the arguments
parser = argparse.ArgumentParser()
parser.add_argument(
"--workspace_fqn", type=str, required=True, help="fqn of the workspace to deploy to"
)
args = parser.parse_args()
# defining the job specifications
job = Job(
name="mnist-train-job",
image=Build(
build_spec=PythonBuild(
command="python train.py --num_epochs {{num_epochs}} --ml_repo {{ml_repo}}",
requirements_path="requirements.txt",
),
build_source=LocalSource(local_build=False)
),
params=[
Param(name="num_epochs", default='4'),
Param(name="ml_repo", param_type="ml_repo"),
],
resources=Resources(
cpu_request=0.5,
cpu_limit=0.5,
memory_request=1500,
memory_limit=2000
)
)
deployment = job.deploy(workspace_fqn=args.workspace_fqn)