https://prefect.io logo
Title
a

Alfie

07/21/2020, 2:56 AM
Hi guys, I hit the error in agent:
ERROR - agent | Error while deploying flow: ValidationError({'_schema': 'Invalid data type: None'})
What I did is creating the workflow with a label and using graphql API to register the flow:
alert_flow.environment = LocalEnvironment(labels=['public'])
create_flow_mutation = """
            mutation($input: create_flow_input!) {
                create_flow(input: $input) {
                    id
                }
            }
        """
        serialized_flow = flow._flow.serialize(build=False)
        self._client.graphql(query=create_flow_mutation,
                             variables=dict(
                                 input=dict(
                                    serialized_flow=serialized_flow,
                                    set_schedule_active=False
                                    )
                                )
                            )
I do not get more log for debugging, please help, thanks!
c

Chris White

07/21/2020, 3:02 AM
Hi Alfie, this isn’t enough information for us to debug unfortunately; it appears that your Flow cannot be deserialized. Maybe try:
from prefect.serialization.flow import FlowSchema

schema = FlowSchema()
schema.load(serialized_flow)
and see if you can figure out which piece of the Flow is causing your error
a

Alfie

07/21/2020, 6:35 AM
Thanks @Chris White, I do see these error via schema.load:
{   'context': {   'create_object': True,
                   'task_cache': {   'delay-1': <Task: delay>,
                                     'filter_query_results-1': <Task: filter_query_results>,
                                     'load_alert_config-1': <Task: load_alert_config>,
                                     'query_in_greenland-1': <Task: query_in_greenland>,
                                     'trigger_action-1': <Task: trigger_action>}},
    'declared_fields': OrderedDict([   (   'project',
                                           <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>),
                                       (   'name',
                                           <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=True, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>),
                                       (   'version',
                                           <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>),
                                       (   'description',
                                           <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>),
                                       (   'type',
                                           <fields.Function(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>),
                                       (   'schedule',
                                           <fields.Nested(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'type': 'Invalid type.'})>),
but the wired thing is the flow works by flow.register()
And just get the problem if I use the graphql to create it
But I want to use arg set_schedule_active in register, and hit this error:
>       flow.register(set_schedule_active=False)
E       TypeError: register() got an unexpected keyword argument 'set_schedule_active'
d

Dave

10/19/2020, 7:53 PM
Did you resolve this? I have received the same error, and are not sure why😞 I know it has something to do with the labels, but that's pretty much it