<#3042 [BUG] Flyte protobuf registration should ex...
# flyte-github
a
#3042 [BUG] Flyte protobuf registration should explicitly have a type information Issue created by pmahindrakar-oss Describe the bug Flyte protobuf serialization produces the following type of objects and written to files • admin.LaunchPlan • admin.WorkflowSpec • admin.TaskSpec Currently flytectl, flytekit and other SDK's use customized mechanism to determine how to Unrmarshal the object written in these files and which type the object has to be unmarshalled into and sent to admin for registration eg : in case of flytectl following code determines how the unrmarshalling happens https://github.com/flyteorg/flytectl/blob/master/cmd/register/register_util.go#L95-L125 This is not deterministic and it's possible that proto unmarshaller is able to unmarshal a file into multiple types which would be an incorrect behavior. Proposed solutions from Haytham. • Change the naming of these files to include a prefix informing flytectl/pyflyte register about how to parse these (e.g. 1_tsk_blast… 2_wf_blast… etc.).. This change will need to happen in all SDKs (python, java, scala)… the register behavior will need to be backward compatible… • Create an envelope message for the data serialized in these files… something like below. And update the registration logic to always only unmarshal into that envelope type. message RegistrationEntity { oneof item { TaskTemplate task = 1; WorkflowTemplate workflow = 2; ... } } There is no way around backward compatibility ugliness here, we will have to fallback to existing logic. Both options require changes in flytekit. I do think the second option a tad better since it doesn’t rely on string comparisons and doesn’t assume the existence of “files” to begin with (this logic works just fine with REST APIs and programmatic APIs)… If we don’t have one already, we should file an issue on this and list these (and other?) options considered and maybe move the discussion there.. Expected behavior Provide a deterministic solution to register the serialized proto files with admin Additional context to reproduce No response Screenshots No response Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte