Any idea what might be causing errors with artifac...
# prefect-community
j
Any idea what might be causing errors with artifact generation? I’m getting these errors in my task runs:
Copy code
Error during execution of task: ClientError([{'path': ['create_task_run_artifact'], 'message': 'Task run <task_run_id> not found', 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}])
k
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?
j
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
k
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?
j
something like
Copy code
class Task():
  def run():
    # do something
    create_markdown()

task = Task()

with Flow("my flow") as Flow:
  task()
k
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
j
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.
k
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?
Copy code
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")
j
yeah exactly
we run it on docker agent with local dask executor if that makes any difference
k
I dont think the docker agent will affect but I can try the local dask executor
v
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.