Robert Bastian

    1 year ago
    When registering a flow that uses prefect.config references I’ve noticed that if the prefect.config is not present the registration throws a Box Error execution.
    File "/usr/local/lib/python3.9/site-packages/prefect/utilities/storage.py", line 86, in extract_flow_from_file
        exec(contents, exec_vals)
      File "<string>", line 10, in <module>
      File "/usr/local/lib/python3.9/site-packages/box/box.py", line 501, in __getattr__
        raise BoxKeyError(str(err)) from _exception_cause(err)
    box.exceptions.BoxKeyError: "'Config' object has no attribute 'direct'"
    I’ve further noticed that if references to config are embedded in tasks that it works. Only when referencing config from a Flow context does this error occur. Is there a workaround for this? It seems strange that I have to install all my environment variables to register a flow when its the Agent that is pushing the envvars into the run-time configuration.
    Kevin Kho

    Kevin Kho

    1 year ago
    Hi @Robert Bastian! I’ll look into this for you.
    I gave wrong advice earlier. Deleted it. The code in the Flow block needs to be able to build, and tasks are used to defer execution. A Parameter would defer the execution. The workaround would be to place these configs it in tasks to defer execution if Parameters don’t make sense.