Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mcp script to avoid follow #1932

Merged
merged 7 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions .github/mcp/mcp_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"""Run pytest using MCP."""

import argparse
from concurrent.futures import TimeoutError

from mcli.sdk import RunConfig, RunStatus, create_run, follow_run_logs, wait_for_run_status
from mcli.sdk import RunConfig, RunStatus, create_run, get_run_logs, stop_runs, wait_for_run_status

if __name__ == '__main__':

Expand Down Expand Up @@ -74,13 +75,26 @@
# Create run
run = create_run(config)

# Wait till run starts before fetching logs
# Wait until run starts before fetching logs
run = wait_for_run_status(run, status='running')
print('Run started. Waiting for run to complete...')

# Wait up to 30 minutes for run to complete
try:
run = wait_for_run_status(run, status='completed', timeout=60 * 30)
except TimeoutError:
print('Run timed out and did not complete in 30 minutes.')

# Get run status and stop run
success = run.status == RunStatus.COMPLETED
print(f'Run completed with status: {run.status} (success={success})')
if run.status == RunStatus.RUNNING:
stop_runs([run])
print('Run stopped.')

# Print logs
for line in follow_run_logs(run):
for line in get_run_logs(run):
print(line, end='')

# Fail if command exited with non-zero exit code
run = wait_for_run_status(run, 'completed')
assert run.status == RunStatus.COMPLETED
# Fail if command exited with non-zero exit code or timed out
assert success
2 changes: 1 addition & 1 deletion composer/algorithms/squeeze_excite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ trainer = Trainer(
model=model,
train_dataloader=train_dataloader,
eval_dataloader=eval_dataloader,
max_duration='10ep',
max_duration='1ep',
algorithms=[algo]
)

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def package_files(prefix: str, directory: str, extension: str):
]

extra_deps['nlp'] = [
'datasets>=2.4,<3',
'transformers>=4.11,<5',
]

Expand Down