Search in sources :

Example 41 with ExecutionMonitor

use of org.knime.core.node.ExecutionMonitor in project knime-core by knime.

the class TestRecursiveMetaNodeUpdate method testAllUpdateAfterLoad.

@Test
public void testAllUpdateAfterLoad() throws Exception {
    getManager().updateMetaNodeLinks(createTemplateLoadHelper(), true, new ExecutionMonitor());
    executeAllAndWait();
    checkStateOfMany(InternalNodeContainerState.CONFIGURED, m_tableDiff_BeforeUpdate_11, m_tableDiff_BeforeUpdate_13, m_tableDiff_BeforeUpdate_15, m_tableDiff_BeforeUpdate_17, m_tableDiff_BeforeUpdate_21);
    checkStateOfMany(InternalNodeContainerState.EXECUTED, m_metaNoUpdateAvail_4, m_metaUpdateOnlyInChild_5, m_metaUpdateTwoChildren_6, m_metaDifferentDefault_7, m_metaHiddenLink_19);
    checkStateOfMany(InternalNodeContainerState.EXECUTED, m_tableDiff_AfterUpdate_22, m_tableDiff_AfterUpdate_23, m_tableDiff_AfterUpdate_27, m_tableDiff_AfterUpdate_28, m_tableDiff_AfterUpdate_30);
}
Also used : ExecutionMonitor(org.knime.core.node.ExecutionMonitor) Test(org.junit.Test)

Example 42 with ExecutionMonitor

use of org.knime.core.node.ExecutionMonitor in project knime-core by knime.

the class BugAP7982_FutureKNIMEVersion_FutureVersion method loadWorkflow.

private WorkflowLoadResult loadWorkflow(final boolean tryToLoadInsteadOfFail) throws Exception {
    File wkfDir = getDefaultWorkflowDirectory();
    WorkflowLoadResult loadWorkflow = loadWorkflow(wkfDir, new ExecutionMonitor(), new WorkflowLoadHelper(wkfDir) {

        @Override
        public UnknownKNIMEVersionLoadPolicy getUnknownKNIMEVersionLoadPolicy(final LoadVersion workflowKNIMEVersion, final Version createdByKNIMEVersion, final boolean isNightlyBuild) {
            assertThat("Unexpected KNIME version in file", workflowKNIMEVersion, is(LoadVersion.FUTURE));
            assertThat("Nightly flag wrong", isNightlyBuild, is(m_isExpectNightly));
            if (tryToLoadInsteadOfFail) {
                return UnknownKNIMEVersionLoadPolicy.Try;
            } else {
                return UnknownKNIMEVersionLoadPolicy.Abort;
            }
        }
    });
    return loadWorkflow;
}
Also used : LoadVersion(org.knime.core.node.workflow.FileWorkflowPersistor.LoadVersion) Version(org.knime.core.util.Version) ExecutionMonitor(org.knime.core.node.ExecutionMonitor) LoadVersion(org.knime.core.node.workflow.FileWorkflowPersistor.LoadVersion) File(java.io.File) WorkflowLoadResult(org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult)

Example 43 with ExecutionMonitor

use of org.knime.core.node.ExecutionMonitor in project knime-core by knime.

the class Enh1536_CancelDuringLoad method testCancelWhileLoad.

@Test
public void testCancelWhileLoad() throws Exception {
    int previousChildCount = WorkflowManager.ROOT.getNodeContainers().size();
    LOAD_NODE_STATE_THREAD_LOCAL.set(LoadNodeState.Default);
    DefaultNodeProgressMonitor progMon = NODE_PROGRESS_THREAD_LOCAL.get();
    try {
        final WorkflowLoadHelper loadHelper = new WorkflowLoadHelper(m_workflowDirectory);
        WorkflowManager.ROOT.load(m_workflowDirectory, new ExecutionMonitor(progMon), loadHelper, true);
        fail("Workflow should not load as it's canceled");
    } catch (CanceledExecutionException e) {
        assertEquals(LoadNodeState.MiddleNodeCanceled, LOAD_NODE_STATE_THREAD_LOCAL.get());
    } finally {
        LOAD_NODE_STATE_THREAD_LOCAL.set(null);
    }
    assertEquals(previousChildCount, WorkflowManager.ROOT.getNodeContainers().size());
}
Also used : CanceledExecutionException(org.knime.core.node.CanceledExecutionException) DefaultNodeProgressMonitor(org.knime.core.node.DefaultNodeProgressMonitor) ExecutionMonitor(org.knime.core.node.ExecutionMonitor) Test(org.junit.Test)

Example 44 with ExecutionMonitor

use of org.knime.core.node.ExecutionMonitor in project knime-core by knime.

the class BlobsInLoops method testLoopExecThenSaveAndLoad.

@Test
public void testLoopExecThenSaveAndLoad() throws Exception {
    checkState(m_source8, InternalNodeContainerState.CONFIGURED);
    executeAndWait(m_loopEnd14, m_verify15);
    checkStateOfMany(InternalNodeContainerState.EXECUTED, m_loopEnd14, m_verify15);
    getManager().save(m_workflowDirTemp, new ExecutionMonitor(), true);
    closeWorkflow();
    Assert.assertThat("Workflow is null", getManager(), IsNull.nullValue());
    init();
    checkStateOfMany(InternalNodeContainerState.EXECUTED, m_loopEnd14, m_verify15);
    reset(m_verify15);
    executeAndWait(m_verify15);
    checkState(m_verify15, InternalNodeContainerState.EXECUTED);
}
Also used : ExecutionMonitor(org.knime.core.node.ExecutionMonitor) Test(org.junit.Test)

Example 45 with ExecutionMonitor

use of org.knime.core.node.ExecutionMonitor in project knime-core by knime.

the class BlobsInLoops method testSimpleExecThenSaveAndLoad.

@Test
public void testSimpleExecThenSaveAndLoad() throws Exception {
    checkStateOfMany(InternalNodeContainerState.CONFIGURED, m_create1, m_source3);
    executeAndWait(m_create1, m_tableWriter4);
    checkStateOfMany(InternalNodeContainerState.EXECUTED, m_create1, m_source3);
    getManager().save(m_workflowDirTemp, new ExecutionMonitor(), true);
    closeWorkflow();
    Assert.assertThat("Workflow is null", getManager(), IsNull.nullValue());
    init();
    checkStateOfMany(InternalNodeContainerState.EXECUTED, m_create1, m_source3);
    checkStateOfMany(InternalNodeContainerState.CONFIGURED, m_verify2, m_tableReader5, m_verify6);
    executeAndWait(m_verify6, m_verify2);
    checkStateOfMany(InternalNodeContainerState.EXECUTED, m_verify2, m_tableReader5, m_verify6);
}
Also used : ExecutionMonitor(org.knime.core.node.ExecutionMonitor) Test(org.junit.Test)

Aggregations

ExecutionMonitor (org.knime.core.node.ExecutionMonitor)160 BufferedDataTable (org.knime.core.node.BufferedDataTable)50 DataTableSpec (org.knime.core.data.DataTableSpec)43 DataRow (org.knime.core.data.DataRow)39 DataCell (org.knime.core.data.DataCell)35 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)35 Test (org.junit.Test)33 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)33 File (java.io.File)29 IOException (java.io.IOException)25 PortObject (org.knime.core.node.port.PortObject)25 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)23 DataColumnSpec (org.knime.core.data.DataColumnSpec)21 RowKey (org.knime.core.data.RowKey)20 ArrayList (java.util.ArrayList)19 WorkflowLoadResult (org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult)17 BufferedDataContainer (org.knime.core.node.BufferedDataContainer)16 ExecutionException (java.util.concurrent.ExecutionException)14 ExecutionContext (org.knime.core.node.ExecutionContext)13 FileOutputStream (java.io.FileOutputStream)12