Exemple #1
0
def test_workflow_update_when_statemachinearn_is_none(client):
    workflow = Workflow(name=state_machine_name,
                        definition=definition,
                        role=role_arn,
                        client=client)
    new_definition = steps.Pass('HelloWorld')
    with pytest.raises(WorkflowNotFound):
        workflow.update(definition=new_definition)
Exemple #2
0
def create_sfn_workflow(params, steps):
    sfn_workflow_name = params['sfn-workflow-name']
    workflow_execution_role = params['sfn-role-arn']

    workflow_graph = Chain(steps)

    branching_workflow = Workflow(
        name=sfn_workflow_name,
        definition=workflow_graph,
        role=workflow_execution_role,
    )

    branching_workflow.create()
    branching_workflow.update(workflow_graph)

    time.sleep(5)

    return branching_workflow
workflow_definition = Chain([
    create_autopilot_job_step, check_autopilot_job_status,
    check_job_wait_state, check_job_choice
])

autopilot_ml_workflow = Workflow(name="AutopilotStateMachineWorkflow",
                                 definition=workflow_definition,
                                 role=utils.get_workflow_role())

try:
    state_machine_arn = autopilot_ml_workflow.create()
except sfn_client.exceptions.StateMachineAlreadyExists as e:
    print(e.message)
else:
    print("Updating workflow definition")
    state_machine_arn = autopilot_ml_workflow.update(workflow_definition)

utils.save_state_machine_arn(state_machine_arn)

timestamp_suffix = strftime('%d-%H-%M-%S', gmtime())

# Uncomment below when you're ready to execute workflow on deployment
# autopilot_ml_workflow.execute(
#     inputs={
#         'AutoMLJobName': f'autopilot-workflow-job-{timestamp_suffix}',
#         'ModelName': f'autopilot-workflow-{timestamp_suffix}-model',
#         'EndpointConfigName': f'autopilot-workflow-{timestamp_suffix}-endpoint-config',
#         'EndpointName': f'autopilot-workflow-{timestamp_suffix}-endpoint',
#         'S3InputData': '',
#         'TargetColumnName': '',
#         'S3OutputData': '',