Skip to content

Commit b42e250

Browse files
committed
AIP-8089 use unique {{workflow.uid}}
1 parent c83a345 commit b42e250

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

kfp/dsl/_volume_op.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(self,
105105
if not match_serialized_pipelineparam(str(resource_name)):
106106
resource_name = sanitize_k8s_name(resource_name)
107107
pvc_metadata = V1ObjectMeta(
108-
name="{{workflow.name}}-%s" % resource_name if generate_unique_name else resource_name,
108+
name="{{workflow.uid}}-%s" % resource_name if generate_unique_name else resource_name,
109109
annotations=annotations)
110110
requested_resources = V1ResourceRequirements(requests={"storage": size})
111111
pvc_spec = V1PersistentVolumeClaimSpec(

kfp/dsl/_volume_snapshot_op.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __init__(self,
9696
if not match_serialized_pipelineparam(str(resource_name)):
9797
resource_name = sanitize_k8s_name(resource_name)
9898
snapshot_metadata = V1ObjectMeta(
99-
name="{{workflow.name}}-%s" % resource_name,
99+
name="{{workflow.uid}}-%s" % resource_name,
100100
annotations=annotations)
101101
k8s_resource = {
102102
"apiVersion": api_version,

metaflow/plugins/aip/aip.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class StepVariables:
9494
user_code_retries: int
9595

9696

97-
METAFLOW_RUN_ID = "argo-{{workflow.name}}"
97+
METAFLOW_RUN_ID = "argo-{{workflow.uid}}"
9898
FLOW_PARAMETERS_JSON = "{{workflow.parameters}}"
9999

100100

@@ -963,12 +963,12 @@ def _create_volume(
963963
api_version="argoproj.io/v1alpha1",
964964
controller=True,
965965
kind="Workflow",
966-
name="{{workflow.name}}",
966+
name="{{workflow.uid}}",
967967
uid=workflow_uid,
968968
)
969969
owner_references = [owner_reference]
970970
pvc_metadata = V1ObjectMeta(
971-
name=f"{{{{workflow.name}}}}-{volume_name}-pvc",
971+
name=f"{{{{workflow.uid}}}}-pvc",
972972
owner_references=owner_references,
973973
)
974974
k8s_resource = V1PersistentVolumeClaim(
@@ -1485,7 +1485,7 @@ def _create_metaflow_step_op(
14851485
if aip_component.interruptible_decorator
14861486
else " --not-interruptible "
14871487
)
1488-
+ " --workflow_name {{workflow.name}}"
1488+
+ " --workflow_name {{workflow.uid}}"
14891489
)
14901490

14911491
if node.name == "start":
@@ -1561,7 +1561,7 @@ def _create_workflow_uid_op(
15611561
f"{package_commands}"
15621562
" && python -m metaflow.plugins.aip.aip_get_workflow_uid"
15631563
f" --s3_sensor_path '{s3_sensor_path}'"
1564-
" --workflow_name {{workflow.name}}"
1564+
" --workflow_name {{workflow.uid}}"
15651565
),
15661566
]
15671567
workflow_uid_op: ContainerOp = dsl.ContainerOp(
@@ -1627,7 +1627,7 @@ def _create_s3_sensor_op(
16271627
(
16281628
f"{package_commands}"
16291629
" && python -m metaflow.plugins.aip.aip_s3_sensor"
1630-
" --run_id argo-{{workflow.name}}"
1630+
" --run_id argo-{{workflow.uid}}"
16311631
f" --flow_name {self.name}"
16321632
f" --flow_parameters_json '{FLOW_PARAMETERS_JSON}'"
16331633
f" --path {path}"
@@ -1762,7 +1762,7 @@ def _get_aip_exit_handler_op(
17621762
f"{package_commands}"
17631763
" && python -m metaflow.plugins.aip.aip_exit_handler"
17641764
f" --flow_name {self.name}"
1765-
" --run_id {{workflow.name}}"
1765+
" --run_id {{workflow.uid}}"
17661766
f" --env_variables_json {json.dumps(json.dumps(env_variables))}"
17671767
f" --flow_parameters_json {flow_parameters_json if flow_parameters else '{}'}"
17681768
" --status {{workflow.status}}"
@@ -1813,7 +1813,7 @@ def _get_user_defined_exit_handler_op(
18131813
f"{package_commands}"
18141814
f" && METAFLOW_USER=aip-user python {os.path.basename(sys.argv[0])} {top_level} aip user-defined-exit-handler"
18151815
f" --flow_name {self.name}"
1816-
" --run_id {{workflow.name}}"
1816+
" --run_id {{workflow.uid}}"
18171817
f" --env_variables_json {json.dumps(json.dumps(env_variables))}"
18181818
f" --flow_parameters_json {flow_parameters_json if flow_parameters else '{}'}"
18191819
" --status {{workflow.status}}"

0 commit comments

Comments
 (0)