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

[API] Resolve function URI when submitting a schedule from hub function #3691

Merged

Conversation

Tankilevitch
Copy link
Contributor

@Tankilevitch Tankilevitch commented Jun 1, 2023

Fixes https://jira.iguazeng.com/browse/ML-3933

Full details for the fix inside the code and the ticket

@Tankilevitch Tankilevitch changed the title [Scheduler] resolve function URI when submitting a schedule from hub function [Scheduler] Resolve function URI when submitting a schedule from hub function Jun 1, 2023
@Tankilevitch Tankilevitch changed the title [Scheduler] Resolve function URI when submitting a schedule from hub function [Submit Job] Resolve function URI when submitting a schedule from hub function Jun 1, 2023
@Tankilevitch Tankilevitch changed the title [Submit Job] Resolve function URI when submitting a schedule from hub function [Submit] Resolve function URI when submitting a schedule from hub function Jun 1, 2023
@Tankilevitch Tankilevitch changed the title [Submit] Resolve function URI when submitting a schedule from hub function [API] Resolve function URI when submitting a schedule from hub function Jun 1, 2023
@Tankilevitch Tankilevitch requested a review from liranbg June 1, 2023 14:29
@Tankilevitch Tankilevitch marked this pull request as ready for review June 1, 2023 15:04
@Tankilevitch Tankilevitch merged commit 0765b92 into mlrun:development Jun 1, 2023
14 checks passed
Copy link
Member

@alonmr alonmr left a comment

Choose a reason for hiding this comment

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

A few questions :)

assert len(schedules) == 1

schedule = schedules[0]
assert schedule["scheduled_object"]["task"]["spec"]["function"] != hub_function_uri
Copy link
Member

Choose a reason for hiding this comment

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

I suggest using a regex to see the function uri is as expected ({project}/{name}@{hash}:{tag})

# if the task is pointing to a remote function (hub://), we need to save it to the db
# and update the task to point to the saved function, so that the scheduler will be able to
# access the db version of the function, and not the remote one (which can be changed between runs)
if "://" in task["spec"]["function"]:
Copy link
Member

Choose a reason for hiding this comment

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

what if the function points to db? (db://)

function_uri = fn.save(versioned=True)
data.pop("function", None)
data.pop("function_url", None)
task["spec"]["function"] = function_uri.replace("db://", "")
Copy link
Member

Choose a reason for hiding this comment

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

why remove the db:// ?

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.

None yet

2 participants