File tree Expand file tree Collapse file tree
job_handler_plugins/azure_container_instances Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ class Config:
77 AUTH_ENABLED = bool (int (os .getenv ("AUTH_ENABLED" , "1" )))
88 DMSS_URL = os .getenv ("DMSS_URL" , "http://dmss:5000" )
99 DM_JOB_URL = os .getenv ("DM_JOB_URL" , "http://job-api:5000" )
10+ # for Azure Container Instance where global addresses of DMSS and DM_JOB are needed
11+ GLOBAL_DMSS_URL = os .getenv ("GLOBAL_DMSS_URL" , "" )
12+ GLOBAL_DM_JOB_URL = os .getenv ("GLOBAL_DM_JOB_URL" , "" ) # Azure stuff
1013
11- # Azure stuff
1214 # Where to run jobs in Azure
1315 AZURE_JOB_SUBSCRIPTION = os .getenv ("AZURE_JOB_SUBSCRIPTION" )
1416 AZURE_JOB_RESOURCE_GROUP = os .getenv ("AZURE_JOB_RESOURCE_GROUP" , "common" )
Original file line number Diff line number Diff line change 2828
2929_SUPPORTED_TYPE = "dmss://WorkflowDS/Blueprints/AzureContainer"
3030
31+ # Interface for Azure
32+
3133
3234class JobHandler (JobHandlerInterface ):
3335 """
@@ -64,14 +66,24 @@ def start(self) -> str:
6466 ]
6567
6668 env_vars .append (EnvironmentVariable (name = "DMSS_TOKEN" , value = self .job .token ))
67- env_vars .append (EnvironmentVariable (name = "DMSS_URL" , value = config .DMSS_URL ))
69+ env_vars .append (EnvironmentVariable (name = "DMSS_URL" , value = config .GLOBAL_DMSS_URL ))
70+ env_vars .append (EnvironmentVariable (name = "DM_JOB_URL" , value = config .GLOBAL_DM_JOB_URL ))
6871 env_vars .append (EnvironmentVariable (name = "JOB_DMSS_ID" , value = self .job .dmss_id ))
6972
7073 # Parse env-vars from job entity
7174 print ("***** Injecting env vars from job entity *****" )
7275 for env_string in self .job .runner .get ("environmentVariables" , []):
73- key = env_string
74- env_vars .append (EnvironmentVariable (name = key , value = os .getenv (env_string )))
76+ if "=" in env_string :
77+ key , value = env_string .split ("=" , 1 )
78+ else :
79+ key = env_string
80+ if key not in os .environ :
81+ logger .warning (
82+ f"Environment variable '{ key } ' specified in job runner but not found in environment. Skipping."
83+ )
84+ continue
85+ value = os .getenv (key )
86+ env_vars .append (EnvironmentVariable (name = key , value = value ))
7587
7688 reference_target : str = self .job .referenceTarget
7789 runner_entity : dict = self .job .runner
You can’t perform that action at this time.
0 commit comments