pratapaditya04 commented on code in PR #4159:
URL: https://github.com/apache/gobblin/pull/4159#discussion_r2663787566


##########
gobblin-temporal/src/main/java/org/apache/gobblin/temporal/cluster/GobblinTemporalTaskRunner.java:
##########
@@ -263,6 +264,38 @@ private TemporalWorker initiateWorker() throws Exception {
     return worker;
   }
 
+  private void initializeExecutionWorkers() throws Exception {
+    boolean dynamicScalingEnabled = ConfigUtils.getBoolean(clusterConfig,
+        GobblinTemporalConfigurationKeys.DYNAMIC_SCALING_ENABLED, false);
+
+    if (!dynamicScalingEnabled) {
+      return;
+    }
+
+    String workerClassName = ConfigUtils.getString(clusterConfig, 
GobblinTemporalConfigurationKeys.WORKER_CLASS,
+        GobblinTemporalConfigurationKeys.DEFAULT_WORKER_CLASS);
+    boolean isExecutionWorkerContainer = 
GobblinTemporalConfigurationKeys.EXECUTION_WORKER_CLASS.equals(workerClassName);
+
+    // only the initial container (WorkFulfillment worker) should start an 
additional ExecutionWorker worker
+    if (isExecutionWorkerContainer) {
+      return;
+    }
+
+    logger.info("Starting additional ExecutionWorker in initial container");
+
+    String namespace = ConfigUtils.getString(clusterConfig, 
GobblinTemporalConfigurationKeys.GOBBLIN_TEMPORAL_NAMESPACE,
+        GobblinTemporalConfigurationKeys.DEFAULT_GOBBLIN_TEMPORAL_NAMESPACE);
+    WorkflowClient client = TemporalWorkflowClientFactory.createClientInstance(
+        managedWorkflowServiceStubs.getWorkflowServiceStubs(), namespace);
+
+    TemporalWorker executionWorker = 
GobblinConstructorUtils.invokeLongestConstructor(
+        
(Class<TemporalWorker>)Class.forName(GobblinTemporalConfigurationKeys.EXECUTION_WORKER_CLASS),
+        clusterConfig, client);
+    executionWorker.start();
+    workers.add(executionWorker);
+    logger.info("Worker started for class: {}", 
GobblinTemporalConfigurationKeys.EXECUTION_WORKER_CLASS);
+  }

Review Comment:
   Have we tested the scenario with 1 container?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to