prefect icon indicating copy to clipboard operation
prefect copied to clipboard

Schedules missing in deployment page

Open DataOps7 opened this issue 1 year ago • 7 comments

First check

  • [X] I added a descriptive title to this issue.
  • [X] I used the GitHub search to find a similar issue and didn't find it.
  • [X] I searched the Prefect documentation for this issue.
  • [X] I checked that this issue is related to Prefect and not one of its dependencies.

Bug summary

I'm getting this error on Prefect community edition version 3.0.0rc10 When looking at a specific deployment page, at the top right, the "Schedules" title is there but the schedules are missing.

When going to Chrome's dev console (f12), I'm seeing the following error:

TypeError: a.schedules.toSorted is no a function

Can't upload a screenshot due to company policy.

Reproduction

Open any deployment page

Error

No response

Versions (prefect version output)

Version: 3.0.0rc10
API version: 0.8.4
Python version: 3.10.14
GitCommit: 200cf212
Built: Wed, Jul 3, 2024 1:39 PM
OS/Arch: linux/x86_64
Profile: default
Server type: server
Pydantic version: 2.8.0

Additional context

No response

DataOps7 avatar Jul 16 '24 11:07 DataOps7

🙇 — thanks for reporting. This feels like a high priority issue, and we'll address it accordingly.

aaazzam avatar Jul 16 '24 11:07 aaazzam

Hi @DataOps7 - thanks for the issue! I appreciate that you can't share a screenshot but is it possible to share the schedule you are using? I can't reproduce with a simple interval or cron schedule so any extra information you can provide would be helpful. Thanks!

zhen0 avatar Jul 16 '24 12:07 zhen0

I have the same issue. See attached screenshot of the missing schedules below. Its worth noting that despite not showing the schedules, a schedule is configured through the CLI and the schedule is functional.

Versions:

Python: 3.9.7 Prefect: 2.16.9 Microsoft Edge: 99.0.1150.46 (Official build) (64-bit)

image

barskern avatar Aug 14 '24 10:08 barskern

@zhen0 @barskern That's exactly what I'm experiencing!

DataOps7 avatar Aug 18 '24 08:08 DataOps7

Just noticed the deployment stats are missing too, I don't have the graphs show below: (Noting that I'm running in an offline air-gapped network) image

DataOps7 avatar Aug 18 '24 10:08 DataOps7

The machine I see the issue on is also "offline", i.e. no access to the internet. (Perhaps it is relevant)

barskern avatar Aug 18 '24 20:08 barskern

Thanks for that @DataOps7 and @barskern -- would you mind sharing the schedules for the deployments you're seeing issues for? I'm having trouble recreating this bug (even offline)

dylanbhughes avatar Aug 19 '24 17:08 dylanbhughes

@dylanbhughes I'm using python to deploy my flow, using a basic cron schedule like "0 0 * * *"

DataOps7 avatar Sep 04 '24 16:09 DataOps7

Hey @DataOps7, I'm still struggling to reproduce this. Could you please provide a reproduction? Here's an example of what we're looking for:

Prefect Version Output

Version: 3.0.0rc10
API version: 0.8.4
Python version: 3.10.14
GitCommit: 200cf212
Built: Wed, Jul 3, 2024 1:39 PM
OS/Arch: linux/x86_64
Profile: default
Server type: server
Pydantic version: 2.8.0

Flow Example

from pathlib import Path
from time import sleep

from prefect import flow, task
from prefect.client.schemas.schedules import CronSchedule


def fetch_batch(i: int):
    # Simulate fetching a batch of data
    sleep(2)


@task
def fetch_in_batches(batches: int):
    for i in range(1, batches + 1):
        fetch_batch(i)


@flow
def etl(batches: int = 10):
    fetch_in_batches(batches)


if __name__ == "__main__":
    etl.from_source(
        source=str(Path(__file__).parent),
        entrypoint="duplicate_deployment_example.py:etl",
    ).deploy(
        name="etl",
        work_pool_name="my_work_pool",
        schedules=[
            {
                "schedule": CronSchedule(cron="0 0 * * *"),
            }
        ],
    )

In this example, I'm using a process work pool & worker.

Result

Screenshot 2024-09-06 at 10 38 15 AM

dylanbhughes avatar Sep 06 '24 14:09 dylanbhughes

It's a bit of a problem to provide a reproduction as the problem only happens in an air gapped offline network. @barskern Do you have a way of reproducing this and providing the awesome Prefect team with the details?

I can try copying my flow line by line but it's just something like:

@flow
def my_flow():
    print("Hey!")
    return

if __name__ == "__main__":
    my_flow.deploy(cron="0 0 * * *")

The cron works fine, it's just a UI problem which also blocks me from pausing flows as the schedules are missing.

DataOps7 avatar Sep 08 '24 13:09 DataOps7

It's a bit of a problem to provide a reproduction as the problem only happens in an air gapped offline network.

@barskern Do you have a way of reproducing this and providing the awesome Prefect team with the details?

I can try copying my flow line by line but it's just something like:


@flow

def my_flow():

    print("Hey!")

    return



if __name__ == "__main__":

    my_flow.deploy(cron="0 0 * * *")

The cron works fine, it's just a UI problem which also blocks me from pausing flows as the schedules are missing.

Sadly no. I have seen the issue in at an airgapped system aswell. An the schedule itself doesnt matter. Further the exact same configuration and schedule is working when I run it on another server with internet access or on my laptop.

barskern avatar Sep 08 '24 19:09 barskern

Thanks to both of you for sharing those details! I'm not very familiar with airgapped systems — can you tell me a little bit more about how you install Prefect onto those machines? I'm wondering if there's something about the installation process that's different from pip install prefect and if that results in misconfiguration or if there's an asset we're not properly including in the pypi distribution and is being fetched over the wire.

dylanbhughes avatar Sep 09 '24 14:09 dylanbhughes

Our Prefect server runs on K8S, and I used pip to install Prefect from a private pypi registry, it shouldn't be any different then online.

DataOps7 avatar Sep 12 '24 08:09 DataOps7

So it looks like there's some work pool information that we used to fetch from GitHub, but that's included in the PyPI package now. If you can share the full route that returns a 422, that could help us track this down.

dylanbhughes avatar Sep 12 '24 20:09 dylanbhughes

I'm not getting a 422, I'm getting the error that @barskern mentioned above - TypeError: a.schedules.toSorted is not a function

DataOps7 avatar Sep 16 '24 11:09 DataOps7

Gotcha, If you're not seeing a 422, it's still hard to understand what's causing this issue. If anyone else in the community can share an MRE, we can look into this further 👍🏻

For now, without an MRE it's really hard for us to know which steps to take to try to resolve this. I'm going to close the issue but we'll reopen if we get further information.

The other option here is to try upgrading to the latest 2.x or 3.x versions as appropriate. We've changed how we fetched some information about work pools so it's possible this will resolve the issue.

dylanbhughes avatar Sep 16 '24 14:09 dylanbhughes