Hi all. Having some issues with the prefect deploy...
# ask-community
m
Hi all. Having some issues with the prefect deploy --all option in our cicid. Something about a duplicate pydantic validator function. --name works. I also tried to replicate the locally with the exact same deps and no luck. Anyone encounter a similar issue?
a
hey @Michael Z what version are you on?
m
prefect 2.12.1.
a
trying to reproduce on my end but feel like I'm being gaslit locally like you are, but have my 👀 on this in particular since we've been doing more to support pydantic v2 (but didn't make any pydantic changes until 2.13.5) so very interested in helping get this figured out
m
hmm yes its pretty strange, locally I fixed pydantic to version 1.10.12
I'll let you know if I figure it out otherwise i'll probably just write a simple script to read the yaml and deploy individually using --name
a
Okay I’m subscribed to this thread but also dm me whenever - I’ll share whatever I learn too
👍 1
u
Please share any error messages or tracebacks if you still have access to those 🙏
m
Any update on this -- I'm having hte same issue
u
hey @Marc Lipoff, can you share any errors/exceptions that you're seeing?
m
Here is the error. I am on prefect 2.13.4, python 3.11, pydantic==1.10.8
Copy code
Traceback (most recent call last):
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/workdir/data_orchestration/flows/export_provider_opensearch/export_provider_opensearch.py", line 70, in <module>
    class ProviderSearchIndex(OpensearchIndex):
  File "/workdir/data_orchestration/flows/export_provider_opensearch/export_provider_opensearch.py", line 80, in ProviderSearchIndex
    @validator("version")
     ^^^^^^^^^^^^^^^^^^^^
  File "pydantic/class_validators.py", line 93, in pydantic.class_validators.validator.dec
  File "pydantic/class_validators.py", line 156, in pydantic.class_validators._prepare_validator
pydantic.errors.ConfigError: duplicate validator function "__prefect_loader__.ProviderSearchIndex.set_version"; if this is intended, set `allow_reuse=True`
 
The above exception was the direct cause of the following exception:
 
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/utilities/asyncutils.py", line 255, in coroutine_wrapper
    return call()
           ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 382, in __call__
    return self.result()
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 282, in result
    return self.future.result(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 168, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 345, in _run_async
    result = await coro
             ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/deploy.py", line 290, in deploy
    await _run_single_deploy(
  File "/usr/local/lib/python3.11/site-packages/prefect/client/utilities.py", line 51, in with_injected_client
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/deploy.py", line 379, in _run_single_deploy
    flow = await run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/flows.py", line 1172, in load_flow_from_entrypoint
    flow = import_object(entrypoint)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/utilities/importtools.py", line 201, in import_object
    module = load_script_as_module(script_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/utilities/importtools.py", line 164, in load_script_as_module
    raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'flows/export_provider_opensearch/export_provider_opensearch.py' encountered an exception: ConfigError('duplicate validator function "__prefect_loader__.ProviderSearchIndex.set_version"; if this is intended, set `allow_reuse=True`')
An exception occurred.
🚨 Error: The command exited with status 1
@Uriel Mandujano any ideas?