Open adammcmaster opened 6 years ago
In Python:
>>> w = Workflow() >>> w.links.project=Project(7) >>> w.display_name = 'Test new workflow' >>> w.primary_language = 'en' >>> w.save() DEBUG:panoptes_client:json={'workflows': {'display_name': 'Test new workflow', 'primary_language': 'en', 'links': {'project': 7}}} DEBUG:urllib3.connectionpool:https://www.zooniverse.org:443 "POST /api/workflows HTTP/1.1" 500 0 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/src/panoptes-python-client/panoptes_client/panoptes.py", line 706, in save etag=self.etag File "/usr/src/panoptes-python-client/panoptes_client/panoptes.py", line 324, in post endpoint=endpoint File "/usr/src/panoptes-python-client/panoptes_client/panoptes.py", line 211, in json_request endpoint File "/usr/src/panoptes-python-client/panoptes_client/panoptes.py", line 189, in http_request response.status_code panoptes_client.panoptes.PanoptesAPIException: Received HTTP status code 500 from API >>> w.tasks = {} >>> w.save() DEBUG:panoptes_client:json={'workflows': {'display_name': 'Test new workflow', 'primary_language': 'en', 'tasks': {}, 'links': {'project': 7}}} DEBUG:urllib3.connectionpool:Resetting dropped connection: www.zooniverse.org DEBUG:urllib3.connectionpool:https://www.zooniverse.org:443 "POST /api/workflows HTTP/1.1" 201 1541 {'workflows': [{'id': '6618', 'display_name': 'Test new workflow', 'tasks': {}, 'classifications_count': 0, 'subjects_count': 0, 'created_at': '2018-04-23T11:32:54.827Z', 'updated_at': '2018-04-23T11:32:54.852Z', 'finished_at': None, 'first_task': None, 'primary_language': 'en', 'version': '1.1', 'content_language': 'en', 'prioritized': False, 'grouped': False, 'pairwise': False, 'retirement': {'criteria': 'classification_count', 'options': {'count': 15}}, 'retired_set_member_subjects_count': 0, 'href': '/workflows/6618', 'active': True, 'mobile_friendly': False, 'aggregation': {}, 'configuration': {}, 'public_gold_standard': False, 'completeness': 0.0, 'links': {'project': '7', 'attached_images': {'href': '/workflows/6618/attached_images', 'type': 'attached_images'}, 'classifications_export': {'href': '/workflows/6618/classifications_export', 'type': 'classifications_exports'}}}], 'links': {'workflows.project': {'href': '/projects/{workflows.project}', 'type': 'projects'}, 'workflows.subject_sets': {'href': '/subject_sets?workflow_id={workflows.id}', 'type': 'subject_sets'}, 'workflows.tutorial_subject': {'href': '/subjects/{workflows.tutorial_subject}', 'type': 'tutorial_subjects'}, 'workflows.attached_images': {'href': '/workflows/{workflows.id}/attached_images', 'type': 'media'}, 'workflows.classifications_export': {'href': '/workflows/{workflows.id}/classifications_export', 'type': 'media'}}, 'meta': {'workflows': {'page': 1, 'page_size': 20, 'count': 1, 'include': [], 'page_count': 1, 'previous_page': None, 'next_page': None, 'first_href': '/workflows', 'previous_href': None, 'next_href': None, 'last_href': '/workflows'}}}
The first save() should return a validation error for the missing tasks, rather than a 500.
save()
Related error in Honeybadger: https://app.honeybadger.io/projects/40595/faults/37501481#notice-comments
In Python:
The first
save()
should return a validation error for the missing tasks, rather than a 500.