Skip to content

Commit bc69a29

Browse files
committed
add callback url to taskmaster env variables
1 parent 54786da commit bc69a29

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/main/java/uk/ac/ebi/tsc/tesk/k8s/constant/Constants.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public class Constants {
2121
*/
2222
public static final String TASKMASTER_INPUT = "JSON_INPUT";
2323

24+
/**
25+
* ENV var that stores the callback URL
26+
*/
27+
public static final String TASKMASTER_CALLBACK_URL = "CALLBACK_URL";
28+
2429
/**
2530
* Key in JSON taskmaster input, which holds list of executors
2631
*/
@@ -69,11 +74,6 @@ public class Constants {
6974
*/
7075
public static final String ANN_JSON_INPUT_KEY = "json-input";
7176

72-
/**
73-
* Key of the annotation, that stores the callback URL
74-
*/
75-
public static final String ANN_CALLBACK_URL_KEY = "callback_url";
76-
7777
/**
7878
* Key of the label, that stores taskmaster's name (==TES task generated ID) in executor jobs
7979
*/

src/main/java/uk/ac/ebi/tsc/tesk/k8s/convert/TesKubernetesConverter.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ public V1Job fromTesTaskToK8sJob(TesTask task, User user) {
7575
V1Job taskMasterJob = this.taskmasterTemplateSupplier.get();
7676
//put input task name as annotation
7777
taskMasterJob.getMetadata().putAnnotationsItem(ANN_TESTASK_NAME_KEY, task.getName());
78-
// put callback URL as annotation
79-
if (task.getCallbackUrl() != null) {
80-
taskMasterJob.getMetadata().putAnnotationsItem(ANN_CALLBACK_URL_KEY, task.getCallbackUrl());
81-
}
8278
//creating user and owning group
8379
taskMasterJob.getMetadata().putLabelsItem(LABEL_USERID_KEY, user.getUsername());
8480
if (task.getTags() != null && task.getTags().containsKey("GROUP_NAME")) {
@@ -117,6 +113,10 @@ public V1Job fromTesTaskToK8sJob(TesTask task, User user) {
117113
String taskMasterInputAsJSON = this.gson.toJson(taskMasterInput);
118114
//placing taskmaster's parameter (JSONed map of: inputs, outputs, volumes, executors (as jobs) into ENV variable in taskmaster spec
119115
taskMasterJob.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv().stream().filter(x -> x.getName().equals(TASKMASTER_INPUT)).forEach(x -> x.setValue(taskMasterInputAsJSON));
116+
//place callback URL as ENV variable in taskmaster spec
117+
if (task.getCallbackUrl() != null) {
118+
taskMasterJob.getSpec().getTemplate().getSpec().getContainers().get(0).addEnvItem(new V1EnvVar().name(TASKMASTER_CALLBACK_URL).value(task.getCallbackUrl()));
119+
}
120120
return taskMasterJob;
121121
}
122122

0 commit comments

Comments
 (0)