-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2024 MosaicML CI-Testing authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import argparse | ||
|
||
from mcli import RunStatus, get_run, stop_run, wait_for_run_status | ||
|
||
"""Cancel an MCLI run.""" | ||
|
||
if __name__ == '__main__': | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--name', type=str, required=True, help='Name of run') | ||
args = parser.parse_args() | ||
|
||
run = get_run(args.name) | ||
|
||
print('[GHA] Stopping run.') | ||
stop_run(run) | ||
|
||
# Wait until run stops | ||
run = wait_for_run_status(run, status=RunStatus.STOPPED) | ||
print('[GHA] Run stopped.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2024 MosaicML CI-Testing authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import argparse | ||
|
||
from mcli import RunStatus, follow_run_logs, get_run, wait_for_run_status | ||
|
||
"""Follow MCLI run logs.""" | ||
|
||
if __name__ == '__main__': | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--name', type=str, required=True, help='Name of run') | ||
args = parser.parse_args() | ||
|
||
run = get_run(args.name) | ||
|
||
# Wait until run starts before fetching logs | ||
run = wait_for_run_status(run, status='running') | ||
print('[GHA] Run started. Following logs...') | ||
|
||
# Print logs | ||
for line in follow_run_logs(run): | ||
print(line, end='') | ||
|
||
print('[GHA] Run completed. Waiting for run to finish...') | ||
run = wait_for_run_status(run, status=RunStatus.COMPLETED) | ||
|
||
# Fail if command exited with non-zero exit code or timed out (didn't reach COMPLETED) | ||
assert run.status == RunStatus.COMPLETED, f'Run {run.name} did not complete: {run.status} ({run.reason})' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters