Thread
#prefect-community
    Josh

    Josh

    5 months ago
    Any idea what might be causing errors with artifact generation? I’m getting these errors in my task runs:
    Error during execution of task: ClientError([{'path': ['create_task_run_artifact'], 'message': 'Task run <task_run_id> not found', 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}])
    Kevin Kho

    Kevin Kho

    5 months ago
    I think so. Artifacts are attached to tasks and use the task id as an identifier. You might be making one outside of a task?
    Josh

    Josh

    5 months ago
    it’s made from the task that it’s in.
    Or at least I was trying to call create artifact from within the task.run method
    Kevin Kho

    Kevin Kho

    5 months ago
    Maybe we can try to grab it from text to pass it in manually one sec
    So it’s tried to just pull it but I guess it can’t. Is that a
    task.run()
    inside a
    task
    inside a
    Flow
    ? Or just a task.run not in a Flow?
    Josh

    Josh

    5 months ago
    something like
    class Task():
      def run():
        # do something
        create_markdown()
    
    task = Task()
    
    with Flow("my flow") as Flow:
      task()
    Kevin Kho

    Kevin Kho

    5 months ago
    This looks pretty right to me. Would you be able to give me a minimal example?
    Or I can try in a couple of hours
    Josh

    Josh

    5 months ago
    I don’t think this is an easily reproducable issue. The problem occurred in a few mapped tasks of a flow run. I can DM you the IDs of the tasks if you want so you can try and locate the logs of those attempts. The errors indicate that there could be something possibly logged on the prefect cloud side that might let you know what the problem was.
    Kevin Kho

    Kevin Kho

    5 months ago
    We dont have any more logs than the ones you see either on your Flow. Can test this tonight.
    So I got around to trying, is your code just something like this?
    from prefect import Task, Flow
    from prefect.backend.artifacts import create_markdown_artifact
    
    class MyTask(Task):
        def run(self, x):
            create_markdown_artifact("# Heading\n\nText with [link](<https://www.prefect.io/>).")
    
    mytask = MyTask()
    with Flow("artifact_test") as flow:
        mytask.map(list(range(100)))
    
    flow.register("databricks")
    Josh

    Josh

    5 months ago
    yeah exactly
    we run it on docker agent with local dask executor if that makes any difference
    Kevin Kho

    Kevin Kho

    5 months ago
    I dont think the docker agent will affect but I can try the local dask executor
    v

    Vinny Tunnell

    4 months ago
    I am facing the same issue with a mapped task that calls
    create_markdown_artifact
    . This was working fine for us for the last few weeks, but this error was thrown multiple times yesterday. We are using LocalDaskExecutor with a Kubernetes agent.