Skip to content

Commit

Permalink
DHFPROD-10199: Renaming QueryStepRunner to ScriptStepRunner.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniela Amy authored and MarkLogic Builder committed May 19, 2023
1 parent 71188b5 commit 7616d00
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"3": {
"jobOutput": [
"java.lang.RuntimeException: org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found\n\tat com.marklogic.hub.collector.impl.CollectorImpl.run(CollectorImpl.java:156)\n\tat com.marklogic.hub.step.impl.QueryStepRunner.runCollector(QueryStepRunner.java:242)\n\tat com.marklogic.hub.step.impl.QueryStepRunner.run(QueryStepRunner.java:196)\n\tat com.marklogic.hub.flow.impl.FlowRunnerImpl$FlowRunnerTask.run(FlowRunnerImpl.java:254)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found\n\tat org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:85)\n\tat org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)\n\tat org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:102)\n\tat com.marklogic.rest.util.MgmtResponseErrorHandler.handleError(MgmtResponseErrorHandler.java:26)\n\tat org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)\n\tat org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:778)\n\tat org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:736)\n\tat org.springframework.web.client.RestTemplate.execute(RestTemplate.java:710)\n\tat com.marklogic.hub.collector.impl.CollectorImpl.run(CollectorImpl.java:150)\n\t... 8 more\n"
"java.lang.RuntimeException: org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found\n\tat com.marklogic.hub.collector.impl.CollectorImpl.run(CollectorImpl.java:156)\n\tat com.marklogic.hub.step.impl.ScriptStepRunner.runCollector(ScriptStepRunner.java:242)\n\tat com.marklogic.hub.step.impl.QueryStepRunner.run(QueryStepRunner.java:196)\n\tat com.marklogic.hub.flow.impl.FlowRunnerImpl$FlowRunnerTask.run(FlowRunnerImpl.java:254)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found\n\tat org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:85)\n\tat org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)\n\tat org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:102)\n\tat com.marklogic.rest.util.MgmtResponseErrorHandler.handleError(MgmtResponseErrorHandler.java:26)\n\tat org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)\n\tat org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:778)\n\tat org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:736)\n\tat org.springframework.web.client.RestTemplate.execute(RestTemplate.java:710)\n\tat com.marklogic.hub.collector.impl.CollectorImpl.run(CollectorImpl.java:150)\n\t... 8 more\n"
],
"failedBatches": 0,
"failedEvents": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.marklogic.hub.impl.HubClientImpl;
import com.marklogic.hub.impl.HubConfigImpl;
import com.marklogic.hub.impl.StepDefinitionManagerImpl;
import com.marklogic.hub.step.impl.QueryStepRunner;
import com.marklogic.hub.step.impl.ScriptStepRunner;
import com.marklogic.hub.step.impl.Step;
import com.marklogic.hub.step.impl.WriteStepRunner;

Expand Down Expand Up @@ -55,7 +55,7 @@ public StepRunner getStepRunner(Flow flow, String stepNum) {
if (StepDefinition.StepDefinitionType.INGESTION.equals(step.getStepDefinitionType())) {
stepRunner = new WriteStepRunner(hubClient, hubProject);
} else {
stepRunner = new QueryStepRunner(hubClient);
stepRunner = new ScriptStepRunner(hubClient);
}

stepRunner = stepRunner.withFlow(flow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

public class QueryStepRunner extends LoggingObject implements StepRunner {
public class ScriptStepRunner extends LoggingObject implements StepRunner {

private static final int MAX_ERROR_MESSAGES = 10;
private Flow flow;
Expand All @@ -63,7 +63,7 @@ public class QueryStepRunner extends LoggingObject implements StepRunner {
private AtomicBoolean isStopped = new AtomicBoolean(false) ;
private StepDefinition stepDef;

public QueryStepRunner(HubClient hubClient) {
public ScriptStepRunner(HubClient hubClient) {
this.hubClient = hubClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class Flow {
* @param flowName
* @param stepNumber
* @param options This isn't just the runtime options provided by the user; because it is expected
* to be called by the processBatch endpoint, which is invoked by the Java QueryStepRunner class,
* to be called by the processBatch endpoint, which is invoked by the Java ScriptStepRunner class,
* this is likely already the set of combined options. But it's not guaranteed to be the same,
* and so combinedOptions is still constructed within this function.
* @return {*}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const stepNumber = inputs.stepNumber;
const jobId = inputs.jobId;

// These are not just the runtime options that a user can provide. It is expected that this is
// called by the Java QueryStepRunner class, which has its own logic for combining options.
// called by the Java ScriptStepRunner class, which has its own logic for combining options.
const options = inputs.options;
const identifiers = options["uris"];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const stepNumber = endpointConstants.stepNumber;
const jobId = endpointConstants.jobId;

// These are not just the runtime options that a user can provide. It is expected that this is
// called by the Java QueryStepRunner class, which has its own logic for combining options.
// called by the Java ScriptStepRunner class, which has its own logic for combining options.
const options = endpointConstants.options.options || endpointConstants.options;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const stepNumber = endpointConstants.stepNumber;
const jobId = endpointConstants.jobId;

// These are not just the runtime options that a user can provide. It is expected that this is
// called by the Java QueryStepRunner class, which has its own logic for combining options.
// called by the Java ScriptStepRunner class, which has its own logic for combining options.
const options = endpointConstants.options.options || endpointConstants.options;


Expand Down Expand Up @@ -71,4 +71,4 @@ if (combinedOptions.uris.length !== 0) {
const newState = latestReturnCount < batchSize ? null: {lastProcessedURI: combinedOptions.uris[latestReturnCount - 1], uris: combinedOptions.uris};

newState;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void verifyExclusionsForFlow(String flowName, String stepId) {
assertEquals(2, response.getStepResponses().get(stepNumber).getSuccessfulEvents(),
"Only the two new items should have been processed since items already processed were excluded");
assertEquals(3, response.getStepResponses().get(stepNumber).getTotalEvents(),
"The QueryStepRunner still thinks 3 items were processed since it sent a batch of 3 items " +
"The ScriptStepRunner still thinks 3 items were processed since it sent a batch of 3 items " +
"to the endpoint");
verifySecondBatchDocument(flowName, stepId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

public class QueryStepRunnerTest extends AbstractHubCoreTest {
public class ScriptStepRunnerTest extends AbstractHubCoreTest {

@Autowired
StepDefinitionManagerImpl stepDefMgr;
Expand All @@ -33,16 +33,16 @@ public void setupEach() throws IOException {
public void testCustomStepWithTransactions() {
installModule("/custom-modules/custom/testTransactionsStep/main.sjs", "step-runner-transactions-test/src/main/ml-modules/root/custom-modules/custom/testTransactionsStep/main.sjs");
installFinalDoc("/test/runThroughTransactions.json", new DocumentMetadataHandle().withCollections("runThroughSeparateTransactions").withPermission("data-hub-common", DocumentMetadataHandle.Capability.READ, DocumentMetadataHandle.Capability.UPDATE), "step-runner-transactions-test/data/runThroughTransactions.json");
QueryStepRunner qsr = new QueryStepRunner(getHubConfig().newHubClient());
ScriptStepRunner ssr = new ScriptStepRunner(getHubConfig().newHubClient());
Flow flow = flowManager.getFullFlow("testFlow");
Map<String, Step> steps = flow.getSteps();
Step step = steps.get("1");
StepDefinition stepDef = stepDefMgr.getStepDefinition(step.getStepDefinitionName(), step.getStepDefinitionType());
Map<String, Object> runtimeOptions = new HashMap<>();
runtimeOptions.put("disableJobOutput", Boolean.TRUE);
qsr.withStepDefinition(stepDef).withFlow(flow).withStep("1").withBatchSize(1).withThreadCount(1).withRuntimeOptions(runtimeOptions);
qsr.run();
qsr.awaitCompletion();
ssr.withStepDefinition(stepDef).withFlow(flow).withStep("1").withBatchSize(1).withThreadCount(1).withRuntimeOptions(runtimeOptions);
ssr.run();
ssr.awaitCompletion();
assertEquals(1, getFinalDocCount("testTransactionsStep"), "Should create 1 new document in testTransactionsStep collection");
assertEquals(1, getFinalDocCount("separateTransaction"), "Should create 1 new document in separateTransaction collection");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"3": {
"jobOutput": [
"java.lang.RuntimeException: org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found\n\tat com.marklogic.hub.collector.impl.CollectorImpl.run(CollectorImpl.java:156)\n\tat com.marklogic.hub.step.impl.QueryStepRunner.runCollector(QueryStepRunner.java:242)\n\tat com.marklogic.hub.step.impl.QueryStepRunner.run(QueryStepRunner.java:196)\n\tat com.marklogic.hub.flow.impl.FlowRunnerImpl$FlowRunnerTask.run(FlowRunnerImpl.java:254)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found\n\tat org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:85)\n\tat org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)\n\tat org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:102)\n\tat com.marklogic.rest.util.MgmtResponseErrorHandler.handleError(MgmtResponseErrorHandler.java:26)\n\tat org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)\n\tat org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:778)\n\tat org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:736)\n\tat org.springframework.web.client.RestTemplate.execute(RestTemplate.java:710)\n\tat com.marklogic.hub.collector.impl.CollectorImpl.run(CollectorImpl.java:150)\n\t... 8 more\n"
"java.lang.RuntimeException: org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found\n\tat com.marklogic.hub.collector.impl.CollectorImpl.run(CollectorImpl.java:156)\n\tat com.marklogic.hub.step.impl.ScriptStepRunner.runCollector(QueryStepRunner.java:242)\n\tat com.marklogic.hub.step.impl.QueryStepRunner.run(QueryStepRunner.java:196)\n\tat com.marklogic.hub.flow.impl.FlowRunnerImpl$FlowRunnerTask.run(FlowRunnerImpl.java:254)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found\n\tat org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:85)\n\tat org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)\n\tat org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:102)\n\tat com.marklogic.rest.util.MgmtResponseErrorHandler.handleError(MgmtResponseErrorHandler.java:26)\n\tat org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)\n\tat org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:778)\n\tat org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:736)\n\tat org.springframework.web.client.RestTemplate.execute(RestTemplate.java:710)\n\tat com.marklogic.hub.collector.impl.CollectorImpl.run(CollectorImpl.java:150)\n\t... 8 more\n"
],
"failedBatches": 0,
"failedEvents": 0,
Expand Down

0 comments on commit 7616d00

Please sign in to comment.