Skip to content

Commit

Permalink
FIX: #459
Browse files Browse the repository at this point in the history
I reverted c5c2712. Now, when a WorkflowRun is created, it starts automatically (like before). I also had to change some unit tests (although one is failing and I'm not sure why...has to do with interactive jobs, I think).

The reason this bug happened in the first place (I think) is because the Rodan worker started trying to execute a RunJob associated with the WorkflowRun before it had been fully created. I'm not 100% sure about this, though.

If we ever get back to having the pre-run state, the changes done in this commit and the previous one (2d4f48a) should be reverted.
  • Loading branch information
mrbannon committed Oct 19, 2016
1 parent 2d4f48a commit 1721de2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
6 changes: 3 additions & 3 deletions rodan/test/test_permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,9 @@ def test_execute_workflowrun(self):
response = self.client.post("/workflowruns/", workflowrun_obj, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
wfrun_id = response.data['uuid']
workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
# workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
# response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
# self.assertEqual(response.status_code, status.HTTP_200_OK)

# 3
counts = {
Expand Down
17 changes: 9 additions & 8 deletions rodan/test/views/test_resultspackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ def setUp(self):
response = self.client.post("/interactive/{0}/".format(str(dummy_m_runjob.uuid)), self.test_user_input)

self.test_workflowrun = WorkflowRun.objects.get(uuid=wfrun_id)
self.assertEqual(self.test_workflowrun.status, task_status.SCHEDULED)
# self.assertEqual(self.test_workflowrun.status, task_status.SCHEDULED)

workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
# workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
# response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
# self.assertEqual(response.status_code, status.HTTP_200_OK)

self.assertEqual(self.test_workflowrun.status, task_status.FINISHED)

Expand Down Expand Up @@ -216,11 +216,12 @@ def setUp(self):
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
wfrun_id = response.data['uuid']
self.test_workflowrun = WorkflowRun.objects.get(uuid=wfrun_id)
self.assertEqual(self.test_workflowrun.status, task_status.SCHEDULED)
# self.assertEqual(self.test_workflowrun.status, task_status.SCHEDULED)
# self.assertEqual(self.test_workflowrun.status, task_status.PROCESSING)

workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
# workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
# response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
# self.assertEqual(response.status_code, status.HTTP_200_OK)

self.test_workflowrun = WorkflowRun.objects.get(uuid=wfrun_id)
self.assertEqual(self.test_workflowrun.status, task_status.FINISHED)
Expand Down
44 changes: 24 additions & 20 deletions rodan/test/views/test_workflowrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def test_post_no_existing_workflow(self):
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

def test_post_status(self):
anticipated_message = {'status': ['Can only create a WorkflowRun that has SCHEDULED status.']}
# anticipated_message = {'status': ['Can only create a WorkflowRun that has SCHEDULED status.']}
anticipated_message = {'status': ['Can only create a WorkflowRun that requests processing.']}
workflowrun_obj = {
'workflow': 'http://localhost:8000/workflow/{0}/'.format(self.test_workflow.uuid),
'status': task_status.CANCELLED,
Expand Down Expand Up @@ -80,7 +81,9 @@ def test_post_invalid_workflow(self):
self.test_workflow.valid = False
self.test_workflow.save()
workflowrun_obj = {
'workflow': 'http://localhost:8000/workflow/{0}/'.format(self.test_workflow.uuid)
'workflow': 'http://localhost:8000/workflow/{0}/'.format(self.test_workflow.uuid),
'status': task_status.REQUEST_PROCESSING
# 'workflow': 'http://localhost:8000/workflow/{0}/'.format(self.test_workflow.uuid)
}

response = self.client.post("/workflowruns/", workflowrun_obj, format='json')
Expand Down Expand Up @@ -340,16 +343,16 @@ def test_successful_execution(self):
dummy_a_runjob = self.dummy_a_wfjob.run_jobs.first()
dummy_m_runjob = self.dummy_m_wfjob.run_jobs.first()

self.assertEqual(dummy_a_runjob.status, task_status.SCHEDULED)
self.assertEqual(dummy_m_runjob.status, task_status.SCHEDULED)
self.assertEqual(WorkflowRun.objects.get(uuid=wfrun_id).status, task_status.SCHEDULED)
# self.assertEqual(dummy_a_runjob.status, task_status.SCHEDULED)
# self.assertEqual(dummy_m_runjob.status, task_status.SCHEDULED)
# self.assertEqual(WorkflowRun.objects.get(uuid=wfrun_id).status, task_status.SCHEDULED)

workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
# workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
# response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
# self.assertEqual(response.status_code, status.HTTP_200_OK)

dummy_a_runjob = self.dummy_a_wfjob.run_jobs.first()
dummy_m_runjob = self.dummy_m_wfjob.run_jobs.first()
# dummy_a_runjob = self.dummy_a_wfjob.run_jobs.first()
# dummy_m_runjob = self.dummy_m_wfjob.run_jobs.first()

# At this point, the automatic RunJob should be finished, and the manual RunJob should wait for input
self.assertEqual(dummy_a_runjob.status, task_status.FINISHED)
Expand Down Expand Up @@ -383,9 +386,9 @@ def test_automatic_job_fail(self):
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
wfrun_id = response.data['uuid']

workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
# workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
# response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
# self.assertEqual(response.status_code, status.HTTP_200_OK)

dummy_a_runjob = self.dummy_a_wfjob.run_jobs.first()
dummy_m_runjob = self.dummy_m_wfjob.run_jobs.first()
Expand All @@ -408,9 +411,9 @@ def test_manual_job_rejected(self):
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
wfrun_id = response.data['uuid']

workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
# workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
# response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
# self.assertEqual(response.status_code, status.HTTP_200_OK)

dummy_a_runjob = self.dummy_a_wfjob.run_jobs.first()
dummy_m_runjob = self.dummy_m_wfjob.run_jobs.first()
Expand Down Expand Up @@ -593,7 +596,8 @@ def assert_same_resource_types(op):
Fo_names_set.add(output.resource_list.name)
self.assertEqual(rc_names_set, Fo_names_set)

self.assertEqual(WorkflowRun.objects.get(uuid=wfrun_id).status, task_status.SCHEDULED)
# self.assertEqual(WorkflowRun.objects.get(uuid=wfrun_id).status, task_status.SCHEDULED)
self.assertEqual(WorkflowRun.objects.get(uuid=wfrun_id).status, task_status.PROCESSING)

def test_execution(self):
ra = self.setUp_resources_for_complex_dummy_workflow()
Expand All @@ -605,9 +609,9 @@ def test_execution(self):
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
wfrun_id = response.data['uuid']

workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
# workflowrun_update = {'status': task_status.REQUEST_PROCESSING}
# response = self.client.patch("/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json')
# self.assertEqual(response.status_code, status.HTTP_200_OK)

rjA = self.test_wfjob_A.run_jobs.first()
rjB = self.test_wfjob_B.run_jobs.first()
Expand Down

0 comments on commit 1721de2

Please sign in to comment.