Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

protect comp.tasks.stats from changes to the structure of subtasks'… #4321

Merged
merged 1 commit into from
Jun 12, 2019
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
23 changes: 17 additions & 6 deletions golem/manager/nodestatesnapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,23 @@ def __init__(
seconds_to_timeout: float,
running_time_seconds: float,
# extra_data:
outfilebasename: str,
output_format: str,
scene_file: str,
frames: List[int],
start_task: int,
total_tasks: int,

# TODO before release 0.21
#
# refactor this state snapshot so that it's independent from
# any particular application type
#
# + ensure that Electron front-end doesn't depend on this data
# being present here and/or having specific format
#
# https://github.com/golemfactory/golem/issues/4318

outfilebasename: str = None,
output_format: str = None,
scene_file: str = None,
frames: List[int] = None,
start_task: int = None,
total_tasks: int = None,
# if there's something more in extra_data, just ignore it
**_kwargs
) -> None:
Expand Down
11 changes: 10 additions & 1 deletion golem/task/taskcomputer.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,23 @@ def get_progress(self) -> Optional[ComputingSubtaskStateSnapshot]:
return None

c: TaskThread = self.counting_thread
try:
outfilebasename = c.extra_data.get( # type: ignore
'crops'
)[0].get(
'outfilebasename'
)
except (IndexError, KeyError):
outfilebasename = ''

tcss = ComputingSubtaskStateSnapshot(
subtask_id=self.assigned_subtask['subtask_id'],
progress=c.get_progress(),
seconds_to_timeout=c.task_timeout,
running_time_seconds=(time.time() - c.start_time),
outfilebasename=outfilebasename,
**c.extra_data,
)

return tcss

def is_computing(self) -> bool:
Expand Down