Skip to content

Normalize str and repr, notably in Task* #73

@thomas-riccardi

Description

@thomas-riccardi

Currently we have very similar str and repr, notably for Task exceptions:

(Pdb) repr(task_timeout)
"TaskTimeout({'id': '348848920', 'status': 'success', 'error': None, 'date_created': '2019-10-22T12:03:16.413978+02:00', 'date_updated': '2019-10-22T12:03:16.546879+02:00', 'data': {'outputs': [{'labels': {'discarded': [], 'predicted': [{'score': 0.808144927, 'label_id': 207, 'threshold': 0.025, 'label_name': 'golden retriever'}, {'score': 0.0409193039, 'label_id': 257, 'threshold': 0.025, 'label_name': 'Great Pyrenees'}]}}]}, 'subtasks': None},)"
(Pdb) str(task_timeout)
'Timeout on task: {"id": "348848920", "status": "success", "error": null, "date_created": "2019-10-22T12:03:16.413978+02:00", "date_updated": "2019-10-22T12:03:16.546879+02:00", "data": {"outputs": [{"labels": {"discarded": [], "predicted": [{"score": 0.808144927, "label_id": 207, "threshold": 0.025, "label_name": "golden retriever"}, {"score": 0.0409193039, "label_id": 257, "threshold": 0.025, "label_name": "Great Pyrenees"}]}}]}, "subtasks": null}'

It may be better to log less things in str: maybe just the task id, status and error?

For Task we should maybe do the same: implement a shorter str.

The issue is probably the same for other resources.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions