Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK - Hiding Argo's workflow.uid placeholder behind DSL #1683

Conversation

Ark-kun
Copy link
Contributor

@Ark-kun Ark-kun commented Jul 26, 2019

Fixes #1673


This change is Reviewable

@Ark-kun Ark-kun requested a review from gaoning777 July 26, 2019 01:17
@Ark-kun Ark-kun force-pushed the SDK---Hiding-Argo's-workflow.uid-placeholder-behind-DSL branch from 0cadd35 to 995d9de Compare July 29, 2019 20:48
from ._artifact_location import ArtifactLocation

task_id_placeholder = '{{workflow.uid}}-{{pod.name}}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might as well add all the argo dynamic params in the dsl and create a submodule called e.g. dsl.param

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other ones seems to already been hidden by DSL (e.g. {{inputs.*}}, {{tasks.*}} etc).
What placeholders do you have in mind?

P.S. I want the DSL placeholders to be portable, so that they can be supported outside Argo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just use {{workflow.uid}} as discussed offline? and backend can replace with the run id.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just use {{workflow.uid}} as discussed offline? and backend can replace with the run id.

I do remember our discussion. Do you think something needs to be changed in this PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a second look. The change LGTM

@IronPan
Copy link
Member

IronPan commented Aug 7, 2019

/lgtm

@gaoning777
Copy link
Contributor

Should we rename the task_id to component_id or something? task_id might sound a little misleading to some of the users.

@gaoning777
Copy link
Contributor

/hold

@Ark-kun
Copy link
Contributor Author

Ark-kun commented Aug 7, 2019

Should we rename the task_id to component_id or something? task_id might sound a little misleading to some of the users.

"task" is an instance of "component".
If you launch three trainers, the component id is the same, but the task ids are different.

@Ark-kun Ark-kun force-pushed the SDK---Hiding-Argo's-workflow.uid-placeholder-behind-DSL branch from 995d9de to 673236b Compare August 7, 2019 21:51
@k8s-ci-robot k8s-ci-robot removed the lgtm label Aug 7, 2019
@gaoning777
Copy link
Contributor

understood. maybe not component_id. However, the task_id concept is the internal concept in the component module.
@hongye-sun WDYT?

@Ark-kun
Copy link
Contributor Author

Ark-kun commented Aug 9, 2019

However, the task_id concept is the internal concept in the component module.

The task_id here is different from the internal task_id (which is the id of a task in a DAG). Maybe we should call it execution_id. WDYT?

@Ark-kun Ark-kun force-pushed the SDK---Hiding-Argo's-workflow.uid-placeholder-behind-DSL branch from 673236b to b1fba34 Compare August 21, 2019 18:58
@Ark-kun
Copy link
Contributor Author

Ark-kun commented Aug 22, 2019

@hongye-sun WDYT?

@Ark-kun
Copy link
Contributor Author

Ark-kun commented Aug 26, 2019

Gentle ping everyone.

@elikatsis
Copy link
Member

Hello there!

Have you thought of exposing {{workflow.name}} or {{pod.name}} similarly?

We already use {{workflow.name}} in VolumeOps and VolumeSnapshotOps prepending the names with it. But it could be of great use for naming purposes when users define custom resources and create them through ResourceOps. (task_id may not comply with K8s naming restrictions, when it starts with a number).

We could add it in a following PR, but I thought it is a good opportunity to introduce them all together.

@Ark-kun
Copy link
Contributor Author

Ark-kun commented Sep 3, 2019

Have you thought of exposing {{workflow.name}} or {{pod.name}} similarly?

The goal here is to expose unique IDs of the run and task execution objects in an orchestrator-agnostic portable way.
Some problems with {{workflow.name}}:

  • It's not unique and can be reused by Kubernetes
  • There already is a proper unique pipeline run ID which is {{workflow.uid}}
    Some problems with {{pod.name}}:
  • It's not unique and can be reused by Kubernetes
  • It's already part of a proper unique task execution ID which is {{workflow.uid}}-{{pod.name}}

Can you give us some user scenarios where the two proposed IDs are insufficient?

task_id may not comply with K8s naming restrictions, when it starts with a number

We should fix this problem. I propose prefixing the IDs with run- and execution-. WDYT?

@elikatsis
Copy link
Member

You are right, uniqueness might be a problem later on (e.g. when GC is performed in following Argo releases). I feel it is hard (not very likely) to occur, but it is still there.

My concern is that {{workflow.uid}} is quite large in terms of length, {{pod.name}} too. That makes them kinda hard to use for resource naming purposes (if a resource has even stricter naming conventions [1]). Also, it makes it hard for users to identify resources related to some execution.

Can you think of any alternative covering the case and being somewhat human-readable?
I'm leaning towards exposing both {{workflow.*}} variables.

Moreover, TFX Taxi Cab sample just came to my mind.
This sample deploys a service (kubeflow deployer component) and then this component handles the name truncated down to 64 characters length (I think it is 64, otherwise it's something close to that).
And I have run into the following problem: if user passes a long tf_server_name (i.e. tf_server_name + ID from generateName > 64 chars), the step will fail because it won't be able to verify the creation of the service or something like that.
So, I think (without having it tested) that this PR might break it.

[1]: Quoting Kubernetes documentation

By convention, the names of Kubernetes resources should be up to maximum length of 253 characters [...] but certain resources have more specific restrictions.

@Ark-kun
Copy link
Contributor Author

Ark-kun commented Sep 25, 2019

@elikatsis Your concerns are valid, but I think they're a bit more like a feature request.
The purpose of this PR is to replace the "magic strings" in samples with constants. So this is just refactoring that does not introduce any change in behavior.

Components that want to pass the IDs to some strictly-formatted fields should do sanitization themselves. E.g. if one place only accepts dashed values and another place wants values with underscores.

We can think about introducing a placeholder for shorter IDs, but it would be a new placeholder, since the behavior is different.

@Ark-kun Ark-kun force-pushed the SDK---Hiding-Argo's-workflow.uid-placeholder-behind-DSL branch from ea84007 to 2e3618b Compare September 25, 2019 21:33
@Ark-kun
Copy link
Contributor Author

Ark-kun commented Sep 25, 2019

Maybe we should call it execution_id. WDYT?

Renamed task_id_placeholder to execution_id_placeholder.
/hold cancel

@Ark-kun
Copy link
Contributor Author

Ark-kun commented Sep 27, 2019

/retest

@Ark-kun
Copy link
Contributor Author

Ark-kun commented Oct 7, 2019

/cc @numerology I've made the changes you proposed.

@numerology
Copy link

/lgtm

@Ark-kun
Copy link
Contributor Author

Ark-kun commented Oct 8, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Ark-kun

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add unique task id placeholder to DSL
9 participants