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

Annotations separate out serializing #326

Merged
merged 25 commits into from
Jan 15, 2021

Conversation

wild-endeavor
Copy link
Contributor

@wild-endeavor wild-endeavor commented Jan 13, 2021

  • Create a new NodeOutput class in the promise file not dependent on the old one. I left an unused sdk_type in there for now cuz that's always None but I'll change it.
  • Move create_and_link_node to the promise file.
  • Move out all the get_registerable_entity logic from everything and put all the logic in one file.
    • Special casing had to be done for Reference entities, raw container tasks, and container-less tasks.
  • Changed a lot of tests to not use the RegistrationSettings object inside a context object because the new function just expects it explicitly. However I didn't see an easy way to remove it from the FlyteContext entirely because of dynamic tasks, which run a compilation step inside of execution and registration settings are not usually passed through during execution.

@wild-endeavor wild-endeavor changed the base branch from master to annotations January 13, 2021 17:51
@wild-endeavor wild-endeavor changed the title [wip] ignore Annotations separate out serializing Jan 14, 2021
@wild-endeavor wild-endeavor marked this pull request as ready for review January 14, 2021 01:27


def get_serializable(
settings: RegistrationSettings, entity: FlyteLocalEntity, fast: Optional[bool] = False
Copy link
Contributor

Choose a reason for hiding this comment

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

what are your thoughts on renaming RegistrationSettings to SerializationSettings since that's now the primary use-case?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor

Choose a reason for hiding this comment

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

as a separate PR is ok

flytekit/common/translator.py Outdated Show resolved Hide resolved
if fast:
# Containerless tasks are always fast registerable without modification so only operate on tasks that
# have a container. Also, raw ContainerTask's should never be touched.
if cp_entity.container is not None and not isinstance(entity, ContainerTask):
Copy link
Contributor

Choose a reason for hiding this comment

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

hm it makes me sad we lose the inheritence bit. i wonder if it's worth refactoring get_container to accept a bool for whether the context should be regular or fast

Copy link
Contributor

Choose a reason for hiding this comment

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

interesting, also, maybe we should do this for any entity that is instance of PythonAutoContainerTask and not ContainerTask. We should assume all container tasks are independent of code?

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 do this in a later PR? As indicated by Miguel's recent question, I want to see if there are additional use cases for changing/overriding the command of a container. Even if not, I'd rather clean up in a separate PR since it's not user facing.



# TODO we should accept TaskMetadata here and then extract whatever fields we want into NodeMetadata
def create_and_link_node(
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe the name of this function needs to be renamed to reflect that we are Substituting outputs with promises

Copy link
Contributor Author

Choose a reason for hiding this comment

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

suggestions?

cp_entity.assign_name(entity.reference.id.name)

elif isinstance(entity, ReferenceWorkflow):
workflow_metadata = WorkflowMetadata(on_failure=WorkflowFailurePolicy.FAIL_IMMEDIATELY)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why?
Why does a reference workflow not look similar, maybe i am missing something

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what do you mean? similar to what?

@kumare3
Copy link
Contributor

kumare3 commented Jan 14, 2021

This looks aaamazing! awesome work

Copy link
Contributor

@katrogan katrogan left a comment

Choose a reason for hiding this comment

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

thanks for refactoring get_serializable to call smaller methods!

flytekit/common/translator.py Outdated Show resolved Hide resolved
)

elif isinstance(entity, ReferenceLaunchPlan):
wf_id = _identifier_model.Identifier(_identifier_model.ResourceType.WORKFLOW, "", "", "", "")
Copy link
Contributor

Choose a reason for hiding this comment

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

not related to this PR but why do you use an empty identiifer rather than filling out the fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No intelligent reason

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will all get deleted i hope

@wild-endeavor wild-endeavor merged commit 452f682 into annotations Jan 15, 2021
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.

3 participants