Skip to content

Commit 72e7a21

Browse files
author
Kowser
committed
Address review comments
1 parent 1c5720f commit 72e7a21

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

conductor-client-spring/src/main/java/com/netflix/conductor/client/spring/ConductorClientAutoConfiguration.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public TaskRunnerConfigurer taskRunnerConfigurer(Environment env,
8585
TaskClient taskClient,
8686
ClientProperties clientProperties,
8787
List<Worker> workers,
88+
Optional<FileClient> fileClient,
8889
Optional<MetricsCollector> metricsCollector) {
8990
Map<String, Integer> taskThreadCount = new HashMap<>();
9091
for (Worker worker : workers) {
@@ -108,6 +109,7 @@ public TaskRunnerConfigurer taskRunnerConfigurer(Environment env,
108109
.withTaskToDomain(clientProperties.getTaskToDomain())
109110
.withShutdownGracePeriodSeconds(clientProperties.getShutdownGracePeriodSeconds())
110111
.withTaskPollTimeout(clientProperties.getTaskPollTimeout());
112+
fileClient.ifPresent(builder::withFileClient);
111113
metricsCollector.ifPresent(builder::withMetricsCollector);
112114
return builder.build();
113115
}
@@ -128,6 +130,7 @@ public WorkflowClient workflowClient(ConductorClient client) {
128130

129131
@Bean
130132
@ConfigurationProperties("conductor.file-client")
133+
@ConditionalOnBean(ConductorClient.class)
131134
@ConditionalOnMissingBean
132135
public FileClientProperties fileClientProperties() {
133136
return new FileClientProperties();

conductor-client-spring/src/main/java/io/orkes/conductor/client/spring/OrkesConductorClientAutoConfiguration.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414

1515
import org.apache.commons.lang3.StringUtils;
1616
import org.conductoross.conductor.client.FileClient;
17+
import org.conductoross.conductor.client.FileClientProperties;
1718
import org.springframework.boot.autoconfigure.AutoConfiguration;
1819
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
1920
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
21+
import org.springframework.boot.context.properties.ConfigurationProperties;
2022
import org.springframework.boot.context.properties.EnableConfigurationProperties;
2123
import org.springframework.context.annotation.Bean;
2224
import org.springframework.context.annotation.Import;
@@ -130,9 +132,17 @@ public SecretClient orkesSecretClient(OrkesClients clients) {
130132
}
131133

132134
@Bean
135+
@ConfigurationProperties("conductor.file-client")
133136
@ConditionalOnBean(ApiClient.class)
134137
@ConditionalOnMissingBean
135-
public FileClient fileClient(ApiClient client) {
136-
return new FileClient(client);
138+
public FileClientProperties fileClientProperties() {
139+
return new FileClientProperties();
140+
}
141+
142+
@Bean
143+
@ConditionalOnBean(ApiClient.class)
144+
@ConditionalOnMissingBean
145+
public FileClient fileClient(ApiClient client, FileClientProperties fileClientProperties) {
146+
return new FileClient(client, fileClientProperties, null);
137147
}
138148
}

conductor-client/src/main/java/com/netflix/conductor/common/metadata/tasks/Task.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,18 @@ public boolean isRetriable() {
189189
private transient WorkflowFileClient workflowFileClient;
190190

191191
@JsonIgnore
192-
public FileUploader getFileUploader() { return workflowFileClient; }
192+
public FileUploader getFileUploader() {
193+
return workflowFileClient;
194+
}
193195

194196
public void setWorkflowFileClient(WorkflowFileClient workflowFileClient) {
195197
this.workflowFileClient = workflowFileClient;
196198
}
197199

198200
public FileHandler getInputFileHandler(String key) {
201+
if (workflowFileClient == null) {
202+
throw new FileStorageException("FileClient is not configured; cannot access file input for key '" + key + "'");
203+
}
199204
Object value = getInputData().get(key);
200205
String fileHandleId = FileHandler.extractFileHandleId(value);
201206
if (FileHandler.isFileHandleId(fileHandleId)) {

0 commit comments

Comments
 (0)