Thread
#prefect-ui
    m

    Manh-Ha

    1 month ago
    Hello. I'm getting started with Prefect v2 and I'm having an error with setting up the Kubernetes Job with Prefect Cloud. I'm trying to configure the Customizations field to modify the output manifest. However, if I write it that way, there is this error while I run the prefect CLI:
    $ prefect deployment build ./expenses.py:export_raw_expenses -n export-raw-expenses -t kubernetes -ib kubernetes-job/job --storage-block azure/azure-storage
    
    Found flow 'export-raw-expenses'
    Successfully uploaded 2 files to <az://prefect/htoh-prefect>
    Traceback (most recent call last):
      File "/Users/manhha/Library/Caches/pypoetry/virtualenvs/htoh-prefect-8QVbx3Ri-py3.10/lib/python3.10/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
        return fn(*args, **kwargs)
      File "/Users/manhha/Library/Caches/pypoetry/virtualenvs/htoh-prefect-8QVbx3Ri-py3.10/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 193, in wrapper
        return run_async_in_new_loop(async_fn, *args, **kwargs)
      File "/Users/manhha/Library/Caches/pypoetry/virtualenvs/htoh-prefect-8QVbx3Ri-py3.10/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 140, in run_async_in_new_loop
        return anyio.run(partial(__fn, *args, **kwargs))
      File "/Users/manhha/Library/Caches/pypoetry/virtualenvs/htoh-prefect-8QVbx3Ri-py3.10/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
        return asynclib.run(func, *args, **backend_options)
      File "/Users/manhha/Library/Caches/pypoetry/virtualenvs/htoh-prefect-8QVbx3Ri-py3.10/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
        return native_run(wrapper(), debug=debug)
      File "/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
        return loop.run_until_complete(main)
      File "/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
        return future.result()
      File "/Users/manhha/Library/Caches/pypoetry/virtualenvs/htoh-prefect-8QVbx3Ri-py3.10/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
        return await func(*args)
      File "/Users/manhha/Library/Caches/pypoetry/virtualenvs/htoh-prefect-8QVbx3Ri-py3.10/lib/python3.10/site-packages/prefect/cli/deployment.py", line 477, in build
        infrastructure = await Block.load(infra_block)
      File "/Users/manhha/Library/Caches/pypoetry/virtualenvs/htoh-prefect-8QVbx3Ri-py3.10/lib/python3.10/site-packages/prefect/blocks/core.py", line 514, in load
        return cls._from_block_document(block_document)
      File "/Users/manhha/Library/Caches/pypoetry/virtualenvs/htoh-prefect-8QVbx3Ri-py3.10/lib/python3.10/site-packages/prefect/blocks/core.py", line 415, in _from_block_document
        block = block_cls.parse_obj(block_document.data)
      File "pydantic/main.py", line 521, in pydantic.main.BaseModel.parse_obj
      File "/Users/manhha/Library/Caches/pypoetry/virtualenvs/htoh-prefect-8QVbx3Ri-py3.10/lib/python3.10/site-packages/prefect/blocks/core.py", line 103, in __init__
        super().__init__(*args, **kwargs)
      File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
    pydantic.error_wrappers.ValidationError: 1 validation error for KubernetesJob
    customizations
      string indices must be integers (type=type_error)
    It looks like the string that the system doesn't like the string I input to the Customizations field:
    {
      "op": "add",
      "path": "/spec/template/spec/containers/0/imagePullPolicy",
      "value": "Always"
    }
    I tried to consult the doc but it only mention the JSON 6902 patch, but nothing more. There is however an example in the Github repo of Prefect. Do you know if I'm missing something?
    Jenny

    Jenny

    1 month ago
    Hello! If you’ve not already seen in the Prefect repo, I think this is likely connected to an issue we’re working on a fix for. You should be able to follow progress here: https://github.com/PrefectHQ/prefect/issues/6460
    m

    Manh-Ha

    1 month ago
    Thank you :yes:. I didn't looked into it indeed. Will check it out.