https://prefect.io logo
n

nicholasnet

07/12/2023, 6:20 PM
We needed persistence volume in our Job so we added it. However, after adding it we are getting this error.
Copy code
/opt/prefect/flows/venv/lib/python3.11/site-packages/prefect/context.py:505: UserWarning: Failed to create the Prefect home directory at /home/python/.prefect                              │
│   with SettingsContext(profile=profile, settings=new_settings) as ctx:                                                                                                                      │
│ Traceback (most recent call last):                                                                                                                                                          │
│                                                                                                                                                         │
│   File "/usr/local/lib/python3.11/pathlib.py", line 1108, in touch                                                                                                                          │
│     fd = os.open(self, flags, mode)                                                                                                                                                         │
│          ^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                         │
│ FileNotFoundError: [Errno 2] No such file or directory: '/home/python/.prefect/prefect.db'                                                                                                  │
│ Stream closed EOF for dev-bidw/orchid-jaguarundi-5vq8g-lbml8 (prefect-job)
This is the
yaml
Copy code
apiVersion: batch/v1
kind: Job
metadata:
    # labels are required, even if empty
    labels: { }
spec:
    template:
        spec:
            completions: 1
            containers: # the first container is required
                -   env:
                        -   name: PREFECT_LOCAL_STORAGE_PATH
                            value: /mnt/data
                    name: prefect-job
                    envFrom:
                        -   secretRef:
                                name: "bidw-cloud"
                    volumeMounts:
                        -   name: bidw-volume
                            mountPath: /mnt/data
            parallelism: 1
            restartPolicy: Never
            volumes:
                -   name: bidw-volume
                    persistentVolumeClaim:
                        claimName: "px-prefect-pvc"
previous version was this and its working as expected.
Copy code
apiVersion: batch/v1
kind: Job
metadata:
    # labels are required, even if empty
    labels: { }
spec:
    template:
        spec:
            completions: 1
            containers: # the first container is required
                -   env:
                        -   name: PREFECT_LOCAL_STORAGE_PATH
                            value: /mnt/data
                    name: prefect-job
                    envFrom:
                        -   secretRef:
                                name: "bidw-cloud"
            parallelism: 1
            restartPolicy: Never
Is there anything that I need to add/edit?