Skip to content

Commit 8e7b1a3

Browse files
Associate a tracked run with an instance ID
1 parent 6e610da commit 8e7b1a3

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

nextmv/nextmv/cloud/application.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,7 +1799,7 @@ def scenario_test(self, scenario_test_id: str) -> BatchExperiment:
17991799

18001800
return self.batch_experiment(batch_id=scenario_test_id)
18011801

1802-
def track_run(self, tracked_run: TrackedRun) -> str:
1802+
def track_run(self, tracked_run: TrackedRun, instance_id: Optional[str] = None) -> str:
18031803
"""
18041804
Track an external run.
18051805
@@ -1812,6 +1812,9 @@ def track_run(self, tracked_run: TrackedRun) -> str:
18121812
----------
18131813
tracked_run : TrackedRun
18141814
The run to track.
1815+
instance_id: Optional[str]
1816+
Optional instance ID if you want to associate your tracked run with
1817+
an instance.
18151818
18161819
Returns
18171820
-------
@@ -1855,12 +1858,17 @@ def track_run(self, tracked_run: TrackedRun) -> str:
18551858
if tracked_run.error is not None and tracked_run.error != "":
18561859
external_result.error_message = tracked_run.error
18571860

1858-
return self.new_run(upload_id=url_input.upload_id, external_result=external_result)
1861+
return self.new_run(
1862+
upload_id=url_input.upload_id,
1863+
external_result=external_result,
1864+
instance_id=instance_id,
1865+
)
18591866

18601867
def track_run_with_result(
18611868
self,
18621869
tracked_run: TrackedRun,
18631870
polling_options: PollingOptions = _DEFAULT_POLLING_OPTIONS,
1871+
instance_id: Optional[str] = None,
18641872
) -> RunResult:
18651873
"""
18661874
Track an external run and poll for the result. This is a convenience
@@ -1874,6 +1882,9 @@ def track_run_with_result(
18741882
The run to track.
18751883
polling_options : PollingOptions
18761884
Options to use when polling for the run result.
1885+
instance_id: Optional[str]
1886+
Optional instance ID if you want to associate your tracked run with
1887+
an instance.
18771888
18781889
Returns
18791890
-------
@@ -1893,7 +1904,7 @@ def track_run_with_result(
18931904
If the run does not succeed after the polling strategy is
18941905
exhausted based on number of tries.
18951906
"""
1896-
run_id = self.track_run(tracked_run=tracked_run)
1907+
run_id = self.track_run(tracked_run=tracked_run, instance_id=instance_id)
18971908

18981909
return self.run_result_with_polling(
18991910
run_id=run_id,

0 commit comments

Comments
 (0)