That said, you might have accessed the artifacts before any of them were registered
PS. I just noticed that this function is not documented. I'll make sure it appears in the doc-string.
Looking at the source code, it seems like I should do:data_processing_task._artifact_manager.flush()
to make sure to have the latest version of artifacts in the task, right?
: For artifacts already registered, returns simply the entry and for artifacts not existing, contact server to retrieve them
This is the current state.
Downloading the artifacts is done only when actually calling get()/get_local_copy()
My bad I wrote refresh and then edited it to the correct "reload" 😞
That said, you might have accessed the artifacts before any of them were registered
I called task.wait_for_status() to make sure the task is done
Downloading the artifacts is done only when actually calling get()/get_local_copy()
Yes, I rather meant: reproduce this behavior even for getting metadata on the artifacts 🙂
This is the issue, I will make sure wait_for_status() calls reload at the ends, so when the function returns you have the updated object
That sounds awesome! It will definitely fix my problem 🙂
In the meantime: I now do:task.wait_for_status() task._artifacts_manager.flush() task.artifacts["output"].get()
But I still get KeyError: 'output'
... Was that normal? Will it work if I replace the second line with task.refresh
() ?
task.wait_for_status() task.reload() task.artifacts["output"].get()
Thanks AgitatedDove14 !
Could we add this task.refresh()
on the docs? Might be helpful for other users as well 🙂 OK! Maybe there is a middle ground: For artifacts already registered, returns simply the entry and for artifacts not existing, contact server to retrieve them
Hi JitteryCoyote63
If you want to refresh the task object, call task.reload()
It will also refresh the artifacts.
The reason for not always do so when accessing the .artifacts objects is for speed optimization (It might be slow compared to dict access, and we assume users will expect it to behave the dict)
I called task.wait_for_status() to make sure the task is done
This is the issue, I will make sure wait_for_status() calls reload at the ends, so when the function returns you have the updated object
Metadata might be expensive, it's a RestAPI call, and we have found users putting hundreds of artifacts, with preview entries ...