Built Docker image not used by my worker (/opt/prefect/my_flows not found by worker, but findable lo...
m

Max Minerz

almost 2 years ago
Built Docker image not used by my worker (/opt/prefect/my_flows not found by worker, but findable locally in container) Hi all ! Hope you're doing well ! I'm currently stuck deploying my flows on my GKE cluster. Here is my configuration : I'm using
prefect deploy
from my
my_flows
directory containing my
prefect.yaml
file
name: my_flows
prefect-version: 2.11.3

build:
  - prefect.deployments.steps.run_shell_script:
      id: get-commit-hash
      script: git rev-parse --short HEAD

  - prefect_docker.deployments.steps.build_docker_image:
      id: build-image
      requires: prefect-docker>=0.3.0
      image_name: my_repo/my_flows
      tag: "{{ get-commit-hash.stdout }}"

push:
  - prefect_docker.deployments.steps.push_docker_image:
      requires: prefect-docker
      image_name: "{{ build-image.image_name }}"
      tag: "{{ build-image.tag }}"
      credentials: "{{ prefect.blocks.docker-registry.docker-registry }}"

pull:
- prefect.projects.steps.set_working_directory:
    directory: /opt/prefect/my_flows

deployments:
  - name: process-lyrics-deployment
    version:
    tags: ["process-lyrics"]
    description:
    schedule: {}
    flow_name:
    entrypoint: process_lyrics/main.py:process_lyrics
    parameters:

    work_pool:
      name: pool-1
      work_queue_name:
      job_variables:
        image: "{{ image_name }}"
And this dockerfile
FROM prefecthq/prefect:2.11.3-python3.8

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . /opt/prefect/my_flows/
When I check my container locally, I can find everything in the directory
/opt/prefect/my_flows/
(as wanted) But when I run my job on my cluster I get this error...
FileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/my_flows'
I'm using one single worker, with the same prefect version as my CLI (
prefect:2.11.3-python3.8
), and configured with
pullPolicy: Always
Since I've seen this forum post : https://discourse.prefect.io/t/how-to-configure-the-pull-step-for-a-project-building-a-docker-image/2777/2 But it doesn't seem to work for me... Thanks in advance for the help ๐Ÿ™
๐Ÿ‘€ 1
Hey guys, I'd really appreciate some help. I've deployed prefect server with what I believe is the ...
n

Nicholas Andonakis

over 1 year ago
Hey guys, I'd really appreciate some help. I've deployed prefect server with what I believe is the simplest possible method. I just have a single Windows Server, and currently a single flow. I start the server with: prefect server start --host 0.0.0.0 And I run my python script with: python main.py It contains: if name == "__main__": my_flow.serve(name="deploymentv1") The deployment is scheduled on the server at 4am every day. Firstly, is this the simplest and most robust method? I really have found the documentation on this stuff really really lacking. The docs and the AI's get clouded with obsolete Prefect V1 content. I suspect I could put the scheduling in the serve command, but the current setup should work. This has been running fine for 2 weeks, but today it just completely failed to schedule the flow run! This is a complete show stopper if I can't rely on it to schedule. Not sure how I can debug this. I tried looking through the server console output and noticed a lot of these messages: sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked [SQL: DELETE FROM flow_run_notification_queue WHERE flow_run_notification_queue.id IN (SELECT 1 FROM (SELECT 1) WHERE 1!=1)] I looked that up and its a known thing? I'm about to wrap the server start in the following batch file to see if it improves and so I can have useful logs. server.bat @echo off set PREFECT_API_SERVICES_FLOW_RUN_NOTIFICATIONS_ENABLED=false prefect server start --host 0.0.0.0 >> server.txt 2>&1 rem email me that the server stopped However I can't proceed with prefect if I can't rely on it to run my flow each day. A bad PLan B is I just use windows task scheduler to run the python flow scripts, but I would lose a lot of the reason for using prefect in the first place if I do that.
Hello, I am having trouble importing prefect flow and task in a databricks notebook. `from prefect ...
j

JoyceC

almost 2 years ago
Hello, I am having trouble importing prefect flow and task in a databricks notebook.
from prefect import flow, task, Parameter
First error was "ImportError: cannot import name 'deprecated' from 'typing_extensions'" when I was using python 3.10. I changed the version to 3.8 and now getting "ImportError: cannot import name 'TypeGuard' from 'typing_extensions' (/databricks/python/lib/python3.8/site-packages/typing_extensions.py)" Here's the full error log. How can I resolve this?
ImportError                               Traceback (most recent call last)
<command-1880743847103486> in <module>
      1 from typing import Any, Awaitable, Dict, List, Optional, Union
----> 2 from prefect import flow, task
      3 from prefect import Parameter
      4 from typing import Any
      5 from datetime import timedelta

/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py in import_patch(name, globals, locals, fromlist, level)
    165             # Import the desired module. If you're seeing this while debugging a failed import,
    166             # look at preceding stack frames for relevant error information.
--> 167             original_result = python_builtin_import(name, globals, locals, fromlist, level)
    168 
    169             is_root_import = thread_local._nest_level == 1

/databricks/python/lib/python3.8/site-packages/prefect/__init__.py in <module>
     35 
     36 # Import user-facing API
---> 37 from prefect.states import State
     38 from prefect.logging import get_run_logger
     39 from prefect.flows import flow, Flow

/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/__init__.py in import_patch(name, globals, locals, fromlist, level)
    165             # Import the desired module. If you're seeing this while debugging a failed import,
    166             # look at preceding stack frames for relevant error information.
--> 167             original_result = python_builtin_import(name, globals, locals, fromlist, level)
    168 
    169             is_root_import = thread_local._nest_level == 1

/databricks/python/lib/python3.8/site-packages/prefect/states.py in <module>
     10 import httpx
     11 import pendulum
---> 12 from typing_extensions import TypeGuard
     13 
     14 from prefect.client.schemas import State as State

ImportError: cannot import name 'TypeGuard' from 'typing_extensions' (/databricks/python/lib/python3.8/site-packages/typing_extensions.py)