This is an automated email from the ASF dual-hosted git repository.
mattcasters pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new b0e3fe2b1b fix results for remote engine, fixes #4826 (#8529)
b0e3fe2b1b is described below
commit b0e3fe2b1b7df664b302b68607c61debc9598724
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Wed Sep 23 17:11:26 2026 +0200
fix results for remote engine, fixes #4826 (#8529)
---
.../engines/remote/RemotePipelineEngine.java | 52 ++-
.../engines/remote/RemotePipelineEngineTest.java | 144 ++++++++
.../0020-add-file-and-rows-to-result.hpl | 175 ++++++++++
.../0020-verify-result-files-and-rows.hpl | 378 +++++++++++++++++++++
...-test-remote-pipeline-result-files-and-rows.hwf | 138 ++++++++
5 files changed, 886 insertions(+), 1 deletion(-)
diff --git
a/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngine.java
b/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngine.java
index 95f3c15a59..68e2c379ad 100644
---
a/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngine.java
+++
b/engine/src/main/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngine.java
@@ -131,6 +131,15 @@ public class RemotePipelineEngine extends Variables
implements IPipelineEngine<P
protected EngineMetrics engineMetrics;
protected Result previousResult;
+ /**
+ * The Result the server reported when the pipeline finished: the result
files and result rows the
+ * transforms produced over there. The periodic status polls leave those out
(a result row set can
+ * be large), so they are fetched once, on the poll that sees the pipeline
finish, and folded into
+ * {@link #getResult()}. Without it a parent workflow only ever saw the
metrics of a remote
+ * pipeline and lost the files it added to the result, see issue #4826.
+ */
+ protected volatile Result remoteResult;
+
protected RemoteHopServer hopServer;
protected ILoggingObject parent;
@@ -245,6 +254,7 @@ public class RemotePipelineEngine extends Variables
implements IPipelineEngine<P
@Override
public void prepareExecution() throws HopException {
+ remoteResult = null;
try {
IPipelineEngineRunConfiguration engineRunConfiguration =
pipelineRunConfiguration.getEngineRunConfiguration();
@@ -565,7 +575,7 @@ public class RemotePipelineEngine extends Variables
implements IPipelineEngine<P
}
}
- private synchronized void getPipelineStatus() throws HopRuntimeException {
+ synchronized void getPipelineStatus() throws HopRuntimeException {
try {
HopServerPipelineStatus pipelineStatus =
hopServer.requestPipelineStatus(this, subject.getName(),
containerId, lastLogLineNr);
@@ -630,6 +640,13 @@ public class RemotePipelineEngine extends Variables
implements IPipelineEngine<P
engineMetrics.getComponents().add(component);
}
+ // Fetch the files and rows before finished is raised: a parent
waiting in
+ // waitUntilFinished() reads getResult() the moment it sees that flag.
+ //
+ if (pipelineStatus.isFinished() && remoteResult == null) {
+ remoteResult =
requestRemoteResult(pipelineStatus.getLastLoggingLineNr());
+ }
+
statusDescription = pipelineStatus.getStatusDescription();
running = pipelineStatus.isRunning();
finished = pipelineStatus.isFinished();
@@ -672,6 +689,31 @@ public class RemotePipelineEngine extends Variables
implements IPipelineEngine<P
}
}
+ /**
+ * Ask the server for the complete Result of the finished pipeline. The
status polls ask for the
+ * basic variant, which carries the metrics only; this second request asks
for the result files
+ * and result rows as well. A failure here is logged rather than thrown: the
pipeline did finish,
+ * and raising the error from the polling timer would leave the parent
waiting forever.
+ */
+ private Result requestRemoteResult(int fromLogLineNr) {
+ try {
+ HopServerPipelineStatus fullStatus =
+ hopServer.requestPipelineStatus(
+ this, subject.getName(), containerId, fromLogLineNr, true);
+ Result result = fullStatus.getResult();
+ return result == null ? new Result() : result;
+ } catch (Exception e) {
+ logChannel.logError(
+ "Unable to retrieve the result files and rows of pipeline '"
+ + subject.getName()
+ + "' from hop server '"
+ + hopServer.getName()
+ + "', the parent will not see them",
+ e);
+ return new Result();
+ }
+ }
+
@Override
public String getStatusDescription() {
return statusDescription;
@@ -865,6 +907,14 @@ public class RemotePipelineEngine extends Variables
implements IPipelineEngine<P
result.setStopped(isStopped());
result.setLogChannelId(getLogChannelId());
+ // The result files and rows only exist on the server; they arrive with
the final status.
+ //
+ Result remote = remoteResult;
+ if (remote != null) {
+ result.getResultFiles().putAll(remote.getResultFiles());
+ result.setRows(remote.getRows());
+ }
+
return result;
}
diff --git
a/engine/src/test/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngineTest.java
b/engine/src/test/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngineTest.java
index a0ed6f326d..e79e2a48b5 100644
---
a/engine/src/test/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngineTest.java
+++
b/engine/src/test/java/org/apache/hop/pipeline/engines/remote/RemotePipelineEngineTest.java
@@ -17,18 +17,38 @@
package org.apache.hop.pipeline.engines.remote;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import java.util.ArrayList;
+import java.util.List;
+import org.apache.hop.core.Result;
+import org.apache.hop.core.ResultFile;
+import org.apache.hop.core.RowMetaAndData;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.logging.LogLevel;
+import org.apache.hop.core.row.RowMeta;
+import org.apache.hop.core.row.value.ValueMetaString;
+import org.apache.hop.core.vfs.HopVfs;
import org.apache.hop.junit.rules.RestoreHopEngineEnvironmentExtension;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider;
+import org.apache.hop.pipeline.Pipeline;
import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.config.PipelineRunConfiguration;
import org.apache.hop.pipeline.engines.local.LocalPipelineRunConfiguration;
+import org.apache.hop.pipeline.transform.TransformStatus;
+import org.apache.hop.www.HopServerPipelineStatus;
+import org.apache.hop.www.RemoteHopServer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -41,6 +61,130 @@ import org.junit.jupiter.api.extension.ExtendWith;
class RemotePipelineEngineTest {
private static final String SERVER_NAME = "a-server";
+ private static final String PIPELINE_NAME = "a-pipeline";
+ private static final String CONTAINER_ID = "container-id";
+
+ /**
+ * A pipeline that runs on a server adds its files to the result over there.
The parent workflow
+ * has to see them, or an action such as Mail has nothing to attach. The
status polls only carry
+ * the metrics, so the files and rows are fetched once the server reports
the pipeline finished.
+ * See issue #4826.
+ */
+ @Test
+ void resultFilesAndRowsOfAFinishedRemotePipelineReachTheParent() throws
Exception {
+ RemoteHopServer hopServer = mock(RemoteHopServer.class);
+ when(hopServer.requestPipelineStatus(any(), eq(PIPELINE_NAME),
eq(CONTAINER_ID), anyInt()))
+ .thenReturn(status(Pipeline.STRING_FINISHED, null));
+ when(hopServer.requestPipelineStatus(
+ any(), eq(PIPELINE_NAME), eq(CONTAINER_ID), anyInt(), eq(true)))
+ .thenReturn(status(Pipeline.STRING_FINISHED, serverResult()));
+ RemotePipelineEngine engine = engine(hopServer);
+
+ engine.getPipelineStatus();
+ Result result = engine.getResult();
+
+ assertTrue(engine.isFinished());
+ assertEquals(1, result.getResultFiles().size(), "The file added on the
server is missing");
+ ResultFile resultFile = result.getResultFilesList().get(0);
+ assertEquals("output.txt", resultFile.getFile().getName().getBaseName());
+ assertEquals(ResultFile.FILE_TYPE_GENERAL, resultFile.getType());
+ assertEquals(2, result.getRows().size(), "The rows copied to the result
are missing");
+ assertEquals("row-2", result.getRows().get(1).getString("name", null));
+ // The metrics are still the ones aggregated from the transform status
list.
+ assertEquals(7, result.getNrLinesWritten());
+ }
+
+ /** The full result is only asked for once, on the poll that sees the
pipeline finish. */
+ @Test
+ void fullResultIsRequestedOnceAndNotWhileRunning() throws Exception {
+ RemoteHopServer hopServer = mock(RemoteHopServer.class);
+ when(hopServer.requestPipelineStatus(any(), eq(PIPELINE_NAME),
eq(CONTAINER_ID), anyInt()))
+ .thenReturn(status(Pipeline.STRING_RUNNING, null),
status(Pipeline.STRING_FINISHED, null));
+ when(hopServer.requestPipelineStatus(
+ any(), eq(PIPELINE_NAME), eq(CONTAINER_ID), anyInt(), eq(true)))
+ .thenReturn(status(Pipeline.STRING_FINISHED, serverResult()));
+ RemotePipelineEngine engine = engine(hopServer);
+
+ engine.getPipelineStatus();
+ assertTrue(engine.isRunning());
+ assertTrue(engine.getResult().getResultFiles().isEmpty());
+ verify(hopServer, never())
+ .requestPipelineStatus(any(), eq(PIPELINE_NAME), eq(CONTAINER_ID),
anyInt(), eq(true));
+
+ engine.getPipelineStatus();
+ engine.getPipelineStatus();
+
+ verify(hopServer, times(1))
+ .requestPipelineStatus(any(), eq(PIPELINE_NAME), eq(CONTAINER_ID),
anyInt(), eq(true));
+ assertEquals(1, engine.getResult().getResultFiles().size());
+ }
+
+ /**
+ * When the server can no longer be asked for the full result the pipeline
still counts as
+ * finished: an exception from the polling timer would leave the parent
waiting forever.
+ */
+ @Test
+ void unavailableFullResultStillFinishesThePipeline() throws Exception {
+ RemoteHopServer hopServer = mock(RemoteHopServer.class);
+ when(hopServer.requestPipelineStatus(any(), eq(PIPELINE_NAME),
eq(CONTAINER_ID), anyInt()))
+ .thenReturn(status(Pipeline.STRING_FINISHED, null));
+ when(hopServer.requestPipelineStatus(
+ any(), eq(PIPELINE_NAME), eq(CONTAINER_ID), anyInt(), eq(true)))
+ .thenThrow(new HopException("server went away"));
+ RemotePipelineEngine engine = engine(hopServer);
+
+ engine.getPipelineStatus();
+
+ assertTrue(engine.isFinished());
+ assertTrue(engine.getResult().getResultFiles().isEmpty());
+ assertEquals(7, engine.getResult().getNrLinesWritten());
+ }
+
+ private static RemotePipelineEngine engine(RemoteHopServer hopServer) {
+ RemotePipelineEngine engine = new RemotePipelineEngine();
+ engine.setLogLevel(LogLevel.BASIC);
+ PipelineMeta pipelineMeta = new PipelineMeta();
+ pipelineMeta.setName(PIPELINE_NAME);
+ engine.setPipelineMeta(pipelineMeta);
+ engine.setPipelineRunConfiguration(remote("remote", "local"));
+ engine.containerId = CONTAINER_ID;
+ engine.hopServer = hopServer;
+ return engine;
+ }
+
+ /** What the server reports: one transform that wrote 7 rows, and optionally
a Result. */
+ private static HopServerPipelineStatus status(String statusDescription,
Result result) {
+ HopServerPipelineStatus status =
+ new HopServerPipelineStatus(PIPELINE_NAME, CONTAINER_ID,
statusDescription);
+ TransformStatus transformStatus = new TransformStatus();
+ transformStatus.setTransformName("Text file output");
+ transformStatus.setStatusDescription(statusDescription);
+ transformStatus.setLinesWritten(7);
+ status.getTransformStatusList().add(transformStatus);
+ status.setResult(result);
+ return status;
+ }
+
+ /** The Result as the server's pipeline built it: one general file and two
result rows. */
+ private static Result serverResult() throws Exception {
+ Result result = new Result();
+ result
+ .getResultFiles()
+ .put(
+ "output.txt",
+ new ResultFile(
+ ResultFile.FILE_TYPE_GENERAL,
+ HopVfs.getFileObject("ram:///" + PIPELINE_NAME +
"/output.txt"),
+ PIPELINE_NAME,
+ "Text file output"));
+ RowMeta rowMeta = new RowMeta();
+ rowMeta.addValueMeta(new ValueMetaString("name"));
+ List<RowMetaAndData> rows = new ArrayList<>();
+ rows.add(new RowMetaAndData(rowMeta, "row-1"));
+ rows.add(new RowMetaAndData(rowMeta, "row-2"));
+ result.setRows(rows);
+ return result;
+ }
/** A remote run configuration that names itself never reaches a server that
would run it. */
@Test
diff --git a/integration-tests/hop_server/0020-add-file-and-rows-to-result.hpl
b/integration-tests/hop_server/0020-add-file-and-rows-to-result.hpl
new file mode 100644
index 0000000000..ef52e0226c
--- /dev/null
+++ b/integration-tests/hop_server/0020-add-file-and-rows-to-result.hpl
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0020-add-file-and-rows-to-result</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description>Runs on the Hop Server through a remote pipeline run
configuration. It adds one
+ file to the result (Text file output, "add filenames to result") and
copies three rows to the
+ result, the two things a parent workflow reads back through the pipeline
Result. The file
+ lands in the server's temporary folder: what the test checks is not the
file but that its
+ result entry, and the rows, reach the workflow on the client. See issue
#4826.</description>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2024/01/01 00:00:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2024/01/01 00:00:00.000</modified_date>
+ <key_for_session_key/>
+ <is_key_private>N</is_key_private>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>Generate 3 rows</from>
+ <to>Write remote result file</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Generate 3 rows</from>
+ <to>Copy rows to result</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>Generate 3 rows</name>
+ <type>RowGenerator</type>
+ <description/>
+ <distribute>N</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <fields>
+ <field>
+ <name>name</name>
+ <type>String</type>
+ <format/>
+ <currency/>
+ <decimal/>
+ <group/>
+ <nullif>remote-row</nullif>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ </field>
+ </fields>
+ <limit>3</limit>
+ <never_ending>N</never_ending>
+ <interval_in_ms>5000</interval_in_ms>
+ <row_time_field>now</row_time_field>
+ <last_time_field>FiveSecondsAgo</last_time_field>
+ <attributes/>
+ <GUI>
+ <xloc>144</xloc>
+ <yloc>96</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Write remote result file</name>
+ <type>TextFileOutput</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <separator>;</separator>
+ <enclosure>"</enclosure>
+ <enclosure_forced>N</enclosure_forced>
+ <enclosure_fix_disabled>N</enclosure_fix_disabled>
+ <header>Y</header>
+ <footer>N</footer>
+ <format>DOS</format>
+ <compression>None</compression>
+ <encoding>UTF-8</encoding>
+ <endedLine/>
+ <fileNameInField>N</fileNameInField>
+ <fileNameField/>
+ <create_parent_folder>Y</create_parent_folder>
+ <file>
+ <name>${java.io.tmpdir}/output-0020/remote-result-file</name>
+ <servlet_output>N</servlet_output>
+ <do_not_open_new_file_init>N</do_not_open_new_file_init>
+ <extention>txt</extention>
+ <append>N</append>
+ <split>N</split>
+ <haspartno>N</haspartno>
+ <add_date>N</add_date>
+ <add_time>N</add_time>
+ <SpecifyFormat>N</SpecifyFormat>
+ <date_time_format/>
+ <add_to_result_filenames>Y</add_to_result_filenames>
+ <pad>N</pad>
+ <fast_dump>N</fast_dump>
+ <splitevery/>
+ </file>
+ <fields>
+ <field>
+ <name>name</name>
+ <type>String</type>
+ <format/>
+ <currency/>
+ <decimal/>
+ <group/>
+ <nullif/>
+ <trim_type>none</trim_type>
+ <length>-1</length>
+ <precision>-1</precision>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>384</xloc>
+ <yloc>48</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Copy rows to result</name>
+ <type>RowsToResult</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ <GUI>
+ <xloc>384</xloc>
+ <yloc>160</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git a/integration-tests/hop_server/0020-verify-result-files-and-rows.hpl
b/integration-tests/hop_server/0020-verify-result-files-and-rows.hpl
new file mode 100644
index 0000000000..166e1a6205
--- /dev/null
+++ b/integration-tests/hop_server/0020-verify-result-files-and-rows.hpl
@@ -0,0 +1,378 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0020-verify-result-files-and-rows</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description>Runs locally, right after 0020-add-file-and-rows-to-result
ran on the server, and
+ reads what that pipeline left in the workflow result: exactly one result
file named
+ remote-result-file.txt and exactly three result rows. Either count being
off aborts the
+ pipeline, which fails the workflow. Only the result entries are read;
the file itself lives on
+ the server and is not opened here.</description>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2024/01/01 00:00:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2024/01/01 00:00:00.000</modified_date>
+ <key_for_session_key/>
+ <is_key_private>N</is_key_private>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>Get files from result</from>
+ <to>Is the remote file?</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Is the remote file?</from>
+ <to>Count files</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Is the remote file?</from>
+ <to>Unexpected file: abort</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Count files</from>
+ <to>files != 1?</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>files != 1?</from>
+ <to>Result file missing: abort</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Get rows from result</from>
+ <to>Count rows</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Count rows</from>
+ <to>rows != 3?</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>rows != 3?</from>
+ <to>Result rows missing: abort</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>Get files from result</name>
+ <type>FilesFromResult</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ <GUI>
+ <xloc>112</xloc>
+ <yloc>96</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Is the remote file?</name>
+ <type>FilterRows</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <send_true_to>Count files</send_true_to>
+ <send_false_to>Unexpected file: abort</send_false_to>
+ <compare>
+ <condition>
+ <leftvalue>filename</leftvalue>
+ <operator>-</operator>
+ <negated>N</negated>
+ <conditions>
+</conditions>
+ <function>=</function>
+ <value>
+ <name>constant</name>
+ <length>-1</length>
+ <text>remote-result-file.txt</text>
+ <isnull>N</isnull>
+ <type>String</type>
+ <mask/>
+ <precision>-1</precision>
+ </value>
+ </condition>
+ </compare>
+ <attributes/>
+ <GUI>
+ <xloc>304</xloc>
+ <yloc>96</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Unexpected file: abort</name>
+ <type>Abort</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <always_log_rows>Y</always_log_rows>
+ <message>A result file other than remote-result-file.txt came back from
the remote pipeline.</message>
+ <abort_option>ABORT_WITH_ERROR</abort_option>
+ <row_threshold>0</row_threshold>
+ <attributes/>
+ <GUI>
+ <xloc>304</xloc>
+ <yloc>208</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Count files</name>
+ <type>GroupBy</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <all_rows>N</all_rows>
+ <ignore_aggregate>N</ignore_aggregate>
+ <field_ignore/>
+ <directory>${java.io.tmpdir}</directory>
+ <prefix>grp</prefix>
+ <add_linenr>N</add_linenr>
+ <linenr_fieldname/>
+ <give_back_row>Y</give_back_row>
+ <group>
+</group>
+ <fields>
+ <field>
+ <aggregate>files</aggregate>
+ <subject>filename</subject>
+ <type>COUNT_ANY</type>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>496</xloc>
+ <yloc>96</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>files != 1?</name>
+ <type>FilterRows</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <send_true_to>Result file missing: abort</send_true_to>
+ <send_false_to/>
+ <compare>
+ <condition>
+ <leftvalue>files</leftvalue>
+ <operator>-</operator>
+ <negated>Y</negated>
+ <conditions>
+</conditions>
+ <function>=</function>
+ <value>
+ <name>constant</name>
+ <length>-1</length>
+ <text>1</text>
+ <isnull>N</isnull>
+ <type>Integer</type>
+ <mask>####0;-####0</mask>
+ <precision>0</precision>
+ </value>
+ </condition>
+ </compare>
+ <attributes/>
+ <GUI>
+ <xloc>688</xloc>
+ <yloc>96</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Result file missing: abort</name>
+ <type>Abort</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <always_log_rows>Y</always_log_rows>
+ <message>The file the remote pipeline added to its result did not reach
the parent workflow (issue #4826).</message>
+ <abort_option>ABORT_WITH_ERROR</abort_option>
+ <row_threshold>0</row_threshold>
+ <attributes/>
+ <GUI>
+ <xloc>880</xloc>
+ <yloc>96</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Get rows from result</name>
+ <type>RowsFromResult</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <fields>
+ <field>
+ <name>name</name>
+ <type>String</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>112</xloc>
+ <yloc>336</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Count rows</name>
+ <type>GroupBy</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <all_rows>N</all_rows>
+ <ignore_aggregate>N</ignore_aggregate>
+ <field_ignore/>
+ <directory>${java.io.tmpdir}</directory>
+ <prefix>grp</prefix>
+ <add_linenr>N</add_linenr>
+ <linenr_fieldname/>
+ <give_back_row>Y</give_back_row>
+ <group>
+</group>
+ <fields>
+ <field>
+ <aggregate>rows</aggregate>
+ <subject>name</subject>
+ <type>COUNT_ANY</type>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>496</xloc>
+ <yloc>336</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>rows != 3?</name>
+ <type>FilterRows</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <send_true_to>Result rows missing: abort</send_true_to>
+ <send_false_to/>
+ <compare>
+ <condition>
+ <leftvalue>rows</leftvalue>
+ <operator>-</operator>
+ <negated>Y</negated>
+ <conditions>
+</conditions>
+ <function>=</function>
+ <value>
+ <name>constant</name>
+ <length>-1</length>
+ <text>3</text>
+ <isnull>N</isnull>
+ <type>Integer</type>
+ <mask>####0;-####0</mask>
+ <precision>0</precision>
+ </value>
+ </condition>
+ </compare>
+ <attributes/>
+ <GUI>
+ <xloc>688</xloc>
+ <yloc>336</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Result rows missing: abort</name>
+ <type>Abort</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <always_log_rows>Y</always_log_rows>
+ <message>The rows the remote pipeline copied to its result did not reach
the parent workflow (issue #4826).</message>
+ <abort_option>ABORT_WITH_ERROR</abort_option>
+ <row_threshold>0</row_threshold>
+ <attributes/>
+ <GUI>
+ <xloc>880</xloc>
+ <yloc>336</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git
a/integration-tests/hop_server/main-0020-test-remote-pipeline-result-files-and-rows.hwf
b/integration-tests/hop_server/main-0020-test-remote-pipeline-result-files-and-rows.hwf
new file mode 100644
index 0000000000..db91fdd673
--- /dev/null
+++
b/integration-tests/hop_server/main-0020-test-remote-pipeline-result-files-and-rows.hwf
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<workflow>
+ <name>main-0020-test-remote-pipeline-result-files-and-rows</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description>Regression test for issue #4826: a pipeline that runs through a
remote pipeline run
+ configuration adds files to its result (Text file output, "add filenames
to result") and copies
+ rows to it, but the parent workflow never saw either. The remote pipeline
engine built its
+ Result from the transform metrics alone and polled the server for the
basic status, which
+ carries no result files or rows. A Mail action after such a pipeline
therefore sent no
+ attachments, and "Get rows from result" read nothing.
+
+ This workflow runs on the client. It executes
0020-add-file-and-rows-to-result.hpl on the test
+ server (run configuration "remote-no-linked-resources", waiting until
finished) and then runs
+ 0020-verify-result-files-and-rows.hpl locally, which reads the workflow
result and aborts unless
+ it holds exactly the one file and the three rows the remote pipeline
produced.</description>
+ <extended_description/>
+ <workflow_version/>
+ <created_user>-</created_user>
+ <created_date>2024/01/01 00:00:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2024/01/01 00:00:00.000</modified_date>
+ <parameters>
+ </parameters>
+ <actions>
+ <action>
+ <name>Start</name>
+ <description/>
+ <type>SPECIAL</type>
+ <attributes/>
+ <DayOfMonth>1</DayOfMonth>
+ <hour>12</hour>
+ <intervalMinutes>60</intervalMinutes>
+ <intervalSeconds>0</intervalSeconds>
+ <minutes>0</minutes>
+ <repeat>N</repeat>
+ <schedulerType>0</schedulerType>
+ <weekDay>1</weekDay>
+ <parallel>N</parallel>
+ <xloc>50</xloc>
+ <yloc>50</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Add file and rows to the result on the server</name>
+ <description/>
+ <type>PIPELINE</type>
+ <attributes/>
+ <filename>${PROJECT_HOME}/0020-add-file-and-rows-to-result.hpl</filename>
+ <params_from_previous>N</params_from_previous>
+ <exec_per_row>N</exec_per_row>
+ <clear_rows>N</clear_rows>
+ <clear_files>N</clear_files>
+ <set_logfile>N</set_logfile>
+ <logfile/>
+ <logext/>
+ <add_date>N</add_date>
+ <add_time>N</add_time>
+ <loglevel>Basic</loglevel>
+ <run_configuration>remote-no-linked-resources</run_configuration>
+ <wait_until_finished>Y</wait_until_finished>
+ <create_parent_folder>N</create_parent_folder>
+ <parameters>
+ <pass_all_parameters>Y</pass_all_parameters>
+ </parameters>
+ <set_append_logfile>N</set_append_logfile>
+ <parallel>N</parallel>
+ <xloc>250</xloc>
+ <yloc>50</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Verify the result files and rows reached this workflow</name>
+ <description>Runs locally with the result of the previous action:
exactly one result file,
+ remote-result-file.txt, and three result rows are
expected.</description>
+ <type>PIPELINE</type>
+ <attributes/>
+
<filename>${PROJECT_HOME}/0020-verify-result-files-and-rows.hpl</filename>
+ <params_from_previous>N</params_from_previous>
+ <exec_per_row>N</exec_per_row>
+ <clear_rows>N</clear_rows>
+ <clear_files>N</clear_files>
+ <set_logfile>N</set_logfile>
+ <logfile/>
+ <logext/>
+ <add_date>N</add_date>
+ <add_time>N</add_time>
+ <loglevel>Basic</loglevel>
+ <run_configuration>local</run_configuration>
+ <wait_until_finished>Y</wait_until_finished>
+ <create_parent_folder>N</create_parent_folder>
+ <parameters>
+ <pass_all_parameters>Y</pass_all_parameters>
+ </parameters>
+ <set_append_logfile>N</set_append_logfile>
+ <parallel>N</parallel>
+ <xloc>560</xloc>
+ <yloc>50</yloc>
+ <attributes_hac/>
+ </action>
+ </actions>
+ <hops>
+ <hop>
+ <from>Start</from>
+ <to>Add file and rows to the result on the server</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>Y</unconditional>
+ </hop>
+ <hop>
+ <from>Add file and rows to the result on the server</from>
+ <to>Verify the result files and rows reached this workflow</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ </hops>
+ <notepads>
+ </notepads>
+ <attributes/>
+</workflow>