-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_links.py
More file actions
33 lines (26 loc) · 1009 Bytes
/
Copy pathdeploy_links.py
File metadata and controls
33 lines (26 loc) · 1009 Bytes
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
"""Register the ingest-links job (PYTHON, pandas-training-pipeline). Idempotent.
Run: hops job run ingest-links
"""
from __future__ import annotations
from pathlib import Path
import hopsworks
JOB_NAME = "ingest-links"
ENV_NAME = "pandas-training-pipeline"
_here = Path(__file__).resolve()
_rel = str(_here).split("/hopsfs/", 1)[1].rsplit("/", 1)[0]
_data = str(_here.parent / "data")
def main():
project = hopsworks.login()
ja = project.get_job_api()
cfg = ja.get_configuration("PYTHON")
cfg["appPath"] = f"hdfs:///Projects/{project.name}/{_rel}/ingest_links.py"
cfg["environmentName"] = ENV_NAME
cfg["defaultArgs"] = f"--data-dir {_data}"
cfg["resourceConfig"]["memory"] = 16384
job = ja.get_job(JOB_NAME)
if job is not None: # config property lost its setter; recreate instead
job.delete(); print(f"deleted stale {JOB_NAME}")
ja.create_job(JOB_NAME, cfg); print(f"created {JOB_NAME}")
print(cfg["appPath"])
if __name__ == "__main__":
main()