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(sdk): single task execute status bug again #1087

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
2 changes: 1 addition & 1 deletion client/starwhale/core/eval/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def _do_run_cmd_in_host(self) -> None:
version=self._version,
workdir=self._model_dir,
dataset_uris=[u.full_uri for u in self.dataset_uris],
step=self.step,
step_name=self.step,
task_index=self.task_index,
kw=dict(
name=self.name,
Expand Down
27 changes: 17 additions & 10 deletions client/starwhale/core/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ def eval_user_handler(
dataset_uris: t.List[str],
model_yaml_name: str = DefaultYAMLName.MODEL,
job_name: str = "default",
step: str = "",
step_name: str = "",
task_index: int = 0,
kw: t.Dict[str, t.Any] = {},
) -> None:
# init manifest
_manifest: t.Dict[str, t.Any] = {
"created_at": now_str(),
"status": STATUS.START,
"step": step,
"step": step_name,
"task_index": task_index,
}
# load model config by yaml
Expand Down Expand Up @@ -253,6 +253,7 @@ def eval_user_handler(

console.print(":hourglass_not_done: start to evaluation...")

_status = STATUS.START
try:
_scheduler = Scheduler(
project=_project_uri.project,
Expand All @@ -263,18 +264,24 @@ def eval_user_handler(
steps=_steps,
kw=kw,
)
if not step:
if not step_name:
_scheduler.schedule()
else:
_scheduler.schedule_single_task(step, task_index)
_scheduler.schedule_single_task(step_name, task_index)
_status = (
STATUS.SUCCESS
if all(
_s.status == STATUS.SUCCESS
for _s in _steps
if step_name == "" or _s.step_name == step_name
)
else STATUS.FAILED
)
except Exception as e:
_manifest["status"] = STATUS.FAILED
_status = STATUS.FAILED
_manifest["error_message"] = str(e)
raise
finally:
_status = True
for _step in _steps:
_status = _status and _step.status == STATUS.SUCCESS
_manifest.update(
{
**dict(
Expand All @@ -283,7 +290,7 @@ def eval_user_handler(
model=_model_config.model[0],
model_dir=str(workdir),
datasets=list(dataset_uris),
status=STATUS.SUCCESS if _status else STATUS.FAILED,
status=_status,
finished_at=now_str(),
),
**kw,
Expand All @@ -294,7 +301,7 @@ def eval_user_handler(

logger.debug(f"job info:{_jobs}")
console.print(
f":100: finish run, {STATUS.SUCCESS if _status else STATUS.FAILED}!"
f":{100 if _status == STATUS.SUCCESS else 'broken_heart'}: finish run, {_status}!"
)

def info(self) -> t.Dict[str, t.Any]:
Expand Down
2 changes: 1 addition & 1 deletion client/starwhale/core/model/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def eval(
version=version,
workdir=workdir,
dataset_uris=dataset_uris,
step=step,
step_name=step,
task_index=task_index,
model_yaml_name=yaml_name,
**kw,
Expand Down