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

changing display URLs for argo #2016

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iamsgarg-ob
Copy link
Contributor

@iamsgarg-ob iamsgarg-ob commented Sep 4, 2024

In this PR I am changing the way the ARGO URLs are constructed. Initially the METAFLOW_ARGO_WORKFLOWS_UI_URL was set to the argo host - and the sub paths were constructed in code.

With this change the METAFLOW_ARGO_WORKFLOWS_UI_URL will be templatized.
The correct template for this setting should be https://metaflow.argo.com/{uri}/{namespace}/{suffix}

The values for the template are threaded through via a dict.

Note: While this change is backwards compatible ( added try/except ) this will cause the argo links in Pagerduty alerts to go wonky. Fix is to change the config and set the value as shown above.

@iamsgarg-ob iamsgarg-ob force-pushed the fix-display-urls branch 2 times, most recently from a53025f to 7e76aaf Compare September 5, 2024 01:13
ARGO_WORKFLOWS_UI_URL.rstrip("/"),
"{{workflow.namespace}}",
"{{workflow.name}}",
"href": ARGO_WORKFLOWS_UI_URL.rstrip("/").format(
Copy link
Contributor Author

@iamsgarg-ob iamsgarg-ob Sep 5, 2024

Choose a reason for hiding this comment

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

ARGO_WORKFLOWS_UI_URL should be set as:

https://metaflow.foo.argo.com/{uri}/{namespace}/{suffix}

@iamsgarg-ob iamsgarg-ob force-pushed the fix-display-urls branch 3 times, most recently from 8f0c18f to 1c4cc80 Compare September 5, 2024 03:35
"suffix": obj.workflow_name,
}
obj.echo("See the deployed workflow here:", bold=True)
argo_workflowtemplate_link = ARGO_WORKFLOWS_UI_URL.rstrip("/").format(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume this was supposed to be part of the above echo? seems to be omitted currently.

Comment on lines +688 to +689
run_url = ARGO_WORKFLOWS_UI_URL.rstrip("/").format(
**workflow_run_url_values
Copy link
Collaborator

Choose a reason for hiding this comment

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

this doesn't raise any exception with "incorrect" url templates. for example

METAFLOW_ARGO_WORKFLOWS_UI_URL=http://example.com/

simply prints out

See the run in the UI at
:
    http://example.com

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep that is the intended behavior.. the exception gets raised if the template has a variable that is missing from the dictionary that is supplied. If the supplied dictionary has extra vars they will simply be ignored

"suffix": argo_workflow_id,
}
obj.echo(json.dumps(workflow_run_url_values))
obj.echo("See the run in the UI at\n:", bold=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

misplaced newline

"*{run_url}*".format(run_url=run_url),
indent=True,
)
except:
Copy link
Collaborator

Choose a reason for hiding this comment

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

bare except, add Exception or something more specific

argo_workflowtemplate_link = ARGO_WORKFLOWS_UI_URL.rstrip("/").format(
**workflow_template_url_values
)
except:
Copy link
Collaborator

Choose a reason for hiding this comment

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

bare except, add Exception or something more specific

"workflow_name": obj.workflow_name,
"suffix": argo_workflow_id,
}
obj.echo(json.dumps(workflow_run_url_values))
Copy link
Collaborator

Choose a reason for hiding this comment

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

leftover debug echo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ha.. good catch.. will remove

obj.echo(
"%s/%s\n\n" % (argo_workflowtemplate_link, obj.workflow_name),
indent=True,
"workflow template was created - errored in formatting workflow template URL"
Copy link
Collaborator

Choose a reason for hiding this comment

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

error message could be more specific that METAFLOW_ARGO_WORKFLOWS_UI_URL could not be used to format the url.

This exception is never raised though, if you try it out with a template url that is missing the required keys

METAFLOW_ARGO_WORKFLOWS_UI_URL=http://example.com/

the only exception you will get is if the template string contains keys that are not present in workflow_template_url_values, such as

METAFLOW_ARGO_WORKFLOWS_UI_URL=http://example.com/{not_present}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that is the intended behavior. Since it's an existing config var in an effort to be backwards compatible this was a little neat solution

"%s/%s/%s" % (UI_URL.rstrip("/"), obj.flow.name, run_id) if UI_URL else None
)

if run_url:
Copy link
Collaborator

Choose a reason for hiding this comment

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

we do not want to remove the url to Metaflow UI in favour of Argo UI though? preferably we keep both, with tidy messaging as introduced in https://github.com/Netflix/metaflow/pull/1934/files#diff-27da6198697d250e8ed1cea087795ecbbf2a0e8e8e0861dd51c1f0062c2f0c41R653
which is a somewhat overlapping PR to this one.

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

Successfully merging this pull request may close these issues.

2 participants