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

Include tileable property in detail api #2493

Merged
merged 14 commits into from
Oct 6, 2021
6 changes: 6 additions & 0 deletions mars/services/task/supervisor/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,11 +599,17 @@ def get_tileable_details(self):
else:
status = SubtaskStatus.running

props = {slot: getattr(tileable, slot, None) for slot in tileable.__slots__}
props = {k: v for k, v in props.get('_FIELD_VALUES').items()
if k != 'key' and isinstance(v, (int, float, str))}

tileable_infos[tileable.key] = {
'progress': progress,
'subtaskCount': len(results),
'status': status.value,
'properties': props,
}

return tileable_infos

def get_tileable_subtasks(self, tileable_id: str, with_input_output: bool):
Expand Down
11 changes: 11 additions & 0 deletions mars/services/task/tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,17 @@ def _get_fields(details, field, wrapper=None):
details = await task_api.get_tileable_details(task_id)
assert details[r7.key]['status'] == SubtaskStatus.errored.value

contain_id_property = False
for tileable in details.keys():
for property_key, property_value in details.get(tileable).get('properties').items():
assert property_key != 'key'
assert isinstance(property_value, (int, float, str))

if property_key == 'id':
contain_id_property = True

assert contain_id_property == True


@pytest.mark.asyncio
@pytest.mark.parametrize('with_input_output', [False, True])
Expand Down