Include closed execution extra info
Include 'closeStatus' and 'closeTimestamp' when describing SWF workflow execution using 'describe_workflow_execution' Signed-off-by: Laurie O <laurie_opperman@hotmail.com>
This commit is contained in:
		
							parent
							
								
									1b4d0b7a1d
								
							
						
					
					
						commit
						353ad631f0
					
				@ -127,6 +127,10 @@ class WorkflowExecution(BaseModel):
 | 
				
			|||||||
            "executionInfo": self.to_medium_dict(),
 | 
					            "executionInfo": self.to_medium_dict(),
 | 
				
			||||||
            "executionConfiguration": {"taskList": {"name": self.task_list}},
 | 
					            "executionConfiguration": {"taskList": {"name": self.task_list}},
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        # info
 | 
				
			||||||
 | 
					        if self.execution_status == "CLOSED":
 | 
				
			||||||
 | 
					            hsh["executionInfo"]["closeStatus"] = self.close_status
 | 
				
			||||||
 | 
					            hsh["executionInfo"]["closeTimestamp"] = self.close_timestamp
 | 
				
			||||||
        # configuration
 | 
					        # configuration
 | 
				
			||||||
        for key in self._configuration_keys:
 | 
					        for key in self._configuration_keys:
 | 
				
			||||||
            attr = camelcase_to_underscores(key)
 | 
					            attr = camelcase_to_underscores(key)
 | 
				
			||||||
 | 
				
			|||||||
@ -148,6 +148,39 @@ def test_workflow_execution_full_dict_representation():
 | 
				
			|||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_closed_workflow_execution_full_dict_representation():
 | 
				
			||||||
 | 
					    domain = get_basic_domain()
 | 
				
			||||||
 | 
					    wf_type = WorkflowType(
 | 
				
			||||||
 | 
					        "test-workflow",
 | 
				
			||||||
 | 
					        "v1.0",
 | 
				
			||||||
 | 
					        task_list="queue",
 | 
				
			||||||
 | 
					        default_child_policy="ABANDON",
 | 
				
			||||||
 | 
					        default_execution_start_to_close_timeout="300",
 | 
				
			||||||
 | 
					        default_task_start_to_close_timeout="300",
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    wfe = WorkflowExecution(domain, wf_type, "ab1234")
 | 
				
			||||||
 | 
					    wfe.execution_status = "CLOSED"
 | 
				
			||||||
 | 
					    wfe.close_status = "CANCELED"
 | 
				
			||||||
 | 
					    wfe.close_timestamp = 1420066801.123
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fd = wfe.to_full_dict()
 | 
				
			||||||
 | 
					    medium_dict = wfe.to_medium_dict()
 | 
				
			||||||
 | 
					    medium_dict["closeStatus"] = "CANCELED"
 | 
				
			||||||
 | 
					    medium_dict["closeTimestamp"] = 1420066801.123
 | 
				
			||||||
 | 
					    fd["executionInfo"].should.equal(medium_dict)
 | 
				
			||||||
 | 
					    fd["openCounts"]["openTimers"].should.equal(0)
 | 
				
			||||||
 | 
					    fd["openCounts"]["openDecisionTasks"].should.equal(0)
 | 
				
			||||||
 | 
					    fd["openCounts"]["openActivityTasks"].should.equal(0)
 | 
				
			||||||
 | 
					    fd["executionConfiguration"].should.equal(
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "childPolicy": "ABANDON",
 | 
				
			||||||
 | 
					            "executionStartToCloseTimeout": "300",
 | 
				
			||||||
 | 
					            "taskList": {"name": "queue"},
 | 
				
			||||||
 | 
					            "taskStartToCloseTimeout": "300",
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_workflow_execution_list_dict_representation():
 | 
					def test_workflow_execution_list_dict_representation():
 | 
				
			||||||
    domain = get_basic_domain()
 | 
					    domain = get_basic_domain()
 | 
				
			||||||
    wf_type = WorkflowType(
 | 
					    wf_type = WorkflowType(
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user