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

bug(client): fix the expired jobs.yaml for workdir mode in the swcli model run command #2184

Merged
merged 1 commit into from
May 8, 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
1 change: 1 addition & 0 deletions client/starwhale/core/model/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ def _run(
"task_index": task_index,
"task_num": override_task_num,
},
force_generate_jobs_yaml=uri is None,
)


Expand Down
3 changes: 2 additions & 1 deletion client/starwhale/core/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def run(
external_info: t.Optional[t.Dict[str, t.Any]] = None,
forbid_snapshot: bool = False,
cleanup_snapshot: bool = True,
force_generate_jobs_yaml: bool = False,
) -> None:
external_info = external_info or {}
dataset_uris = dataset_uris or []
Expand All @@ -335,7 +336,7 @@ def run(
copy_dir(model_src_dir, snapshot_dir)

job_yaml_path = snapshot_dir / SW_AUTO_DIRNAME / DEFAULT_JOBS_FILE_NAME
if not job_yaml_path.exists():
if not job_yaml_path.exists() or force_generate_jobs_yaml:
generate_jobs_yaml(
search_modules=model_config.run.modules,
package_dir=snapshot_dir,
Expand Down
2 changes: 2 additions & 0 deletions client/starwhale/core/model/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def run_in_host(
scheduler_run_args: t.Optional[t.Dict] = None,
forbid_snapshot: bool = False,
cleanup_snapshot: bool = True,
force_generate_jobs_yaml: bool = False,
) -> None:
if runtime_uri:
RuntimeProcess(uri=runtime_uri).run()
Expand All @@ -249,6 +250,7 @@ def run_in_host(
scheduler_run_args=scheduler_run_args,
forbid_snapshot=forbid_snapshot,
cleanup_snapshot=cleanup_snapshot,
force_generate_jobs_yaml=force_generate_jobs_yaml,
)

@classmethod
Expand Down
1 change: 1 addition & 0 deletions client/tests/core/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ def test_run(
"step_name": "ppl",
"task_index": 0,
},
force_generate_jobs_yaml=True,
)
schedule_all_mock.assert_not_called()
single_step_mock.assert_not_called()
Expand Down