Esempio n. 1
0
def test_get_full_execution_inputs(mock_client_factory):
    mock_client = MagicMock()
    mock_client.get_execution_data = MagicMock(
        return_value=_execution_models.WorkflowExecutionGetDataResponse(
            None,
            None,
            _INPUT_MAP,
            _OUTPUT_MAP,
        )
    )
    mock_client_factory.return_value = mock_client

    m = MagicMock()
    type(m).id = PropertyMock(
        return_value=identifier.WorkflowExecutionIdentifier(
            "project",
            "domain",
            "name",
        )
    )

    inputs = engine.FlyteWorkflowExecution(m).get_inputs()
    assert len(inputs.literals) == 1
    assert inputs.literals["a"].scalar.primitive.integer == 1
    mock_client.get_execution_data.assert_called_once_with(
        identifier.WorkflowExecutionIdentifier("project", "domain", "name")
    )
Esempio n. 2
0
def test_get_execution_outputs(mock_client_factory, execution_data_locations):
    mock_client = MagicMock()
    mock_client.get_execution_data = MagicMock(
        return_value=_execution_models.WorkflowExecutionGetDataResponse(
            execution_data_locations[0],
            execution_data_locations[1]
        )
    )
    mock_client_factory.return_value = mock_client

    m = MagicMock()
    type(m).id = PropertyMock(
        return_value=identifier.WorkflowExecutionIdentifier(
            "project",
            "domain",
            "name",
        )
    )

    inputs = engine.FlyteWorkflowExecution(m).get_outputs()
    assert len(inputs.literals) == 1
    assert inputs.literals['b'].scalar.primitive.integer == 2
    mock_client.get_execution_data.assert_called_once_with(
        identifier.WorkflowExecutionIdentifier("project", "domain", "name")
    )
Esempio n. 3
0
def test_workflow_execution_data_response():
    input_blob = _common_models.UrlBlob("in", 1)
    output_blob = _common_models.UrlBlob("out", 2)
    obj = _execution.WorkflowExecutionGetDataResponse(input_blob, output_blob)
    obj2 = _execution.WorkflowExecutionGetDataResponse.from_flyte_idl(
        obj.to_flyte_idl())
    assert obj == obj2
    assert obj2.inputs == input_blob
    assert obj2.outputs == output_blob