Skip to content

Commit f10dd86

Browse files
committed
CH-185 On-exit strategy add custom image parameter fix
1 parent e3276f3 commit f10dd86

File tree

1 file changed

+7
-2
lines changed
  • libraries/cloudharness-common/cloudharness/workflows

1 file changed

+7
-2
lines changed

libraries/cloudharness-common/cloudharness/workflows/operations.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ContainerizedOperation(ManagedOperation):
6060
"""
6161

6262
def __init__(self, basename: str, pod_context: Union[PodExecutionContext, list, tuple] = None,
63-
shared_directory=None, *args, **kwargs):
63+
shared_directory=None, pod_gc=None, *args, **kwargs):
6464
"""
6565
:param basename:
6666
:param pod_context: PodExecutionContext - represents affinity with other pods in the system
@@ -76,6 +76,7 @@ def __init__(self, basename: str, pod_context: Union[PodExecutionContext, list,
7676

7777
self.persisted = None
7878
shared_path = None
79+
self.pod_gc = pod_gc
7980
if shared_directory:
8081
if shared_directory is True:
8182
self.volumes = ['/mnt/shared']
@@ -126,6 +127,10 @@ def spec(self):
126127
'tolerations': [V1Toleration(key='cloudharness/temporary-job', operator='Equal', value='true').to_dict()],
127128
'serviceAccountName': SERVICE_ACCOUNT,
128129
'imagePullSecrets': [{'name': config.CloudharnessConfig.get_registry_secret()}],
130+
'podGC': self.pod_gc or {
131+
'strategy': 'OnWorkflowSuccess',
132+
'deleteDelayDuration': self.ttl_strategy['secondsAfterSuccess'] if self.ttl_strategy else "600s",
133+
},
129134
'volumes': [{
130135
# mount allvalues so we can use the cloudharness Python library
131136
'name': 'cloudharness-allvalues',
@@ -168,7 +173,7 @@ def add_on_exit_notify_handler(self, spec):
168173
payload = self.on_exit_notify['payload']
169174
exit_task = CustomTask(
170175
name="exit-handler",
171-
image_name=self.on_exit_notify('image', 'workflows-notify-queue'),
176+
image_name=self.on_exit_notify.get('image', 'workflows-notify-queue'),
172177
workflow_result='{{workflow.status}}',
173178
queue_name=queue,
174179
payload=payload

0 commit comments

Comments
 (0)