Skip to content

Commit

Permalink
write to file as well
Browse files Browse the repository at this point in the history
  • Loading branch information
madhur-ob committed Jan 16, 2025
1 parent 2599654 commit ed0b639
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions metaflow/plugins/argo/argo_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,7 @@ def _container_templates(self):
},
**{
# Some optional values for bookkeeping
"MF_FLOW_FILENAME": os.path.basename(sys.argv[0]),
"METAFLOW_FLOW_NAME": self.flow.name,
"METAFLOW_STEP_NAME": node.name,
"METAFLOW_RUN_ID": run_id,
Expand Down
3 changes: 3 additions & 0 deletions metaflow/plugins/kubernetes/kubernetes_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,9 @@ def task_pre_step(
self._save_logs_sidecar.start()

# Start spot termination monitor sidecar.
current._update_env(
{"spot_termination_notice": "/tmp/spot_termination_notice"}
)
self._spot_monitor_sidecar = Sidecar("spot_termination_monitor")
self._spot_monitor_sidecar.start()

Expand Down
4 changes: 4 additions & 0 deletions metaflow/plugins/kubernetes/spot_monitor_sidecar.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def _emit_termination_metadata(self, termination_time):
pathspec = os.getenv("MF_PATHSPEC")
_, run_id, step_name, task_id = pathspec.split("/")
retry_count = os.getenv("MF_ATTEMPT")

with open("/tmp/spot_termination_notice", "w") as fp:
fp.write(termination_time)

command = [
sys.executable,
f"/metaflow/{flow_filename}",
Expand Down

0 comments on commit ed0b639

Please sign in to comment.