mirror of
https://github.com/clearml/clearml
synced 2025-06-26 18:16:07 +00:00
Fix taking artifacts from non-completed tasks might fail
This commit is contained in:
parent
70de28ce7b
commit
d63f3b5ca7
@ -7,6 +7,7 @@ from PIL import Image
|
|||||||
from clearml import Task
|
from clearml import Task
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
# Connecting ClearML with the current process,
|
# Connecting ClearML with the current process,
|
||||||
# from here on everything is logged automatically
|
# from here on everything is logged automatically
|
||||||
task = Task.init(project_name='examples', task_name='Artifacts example')
|
task = Task.init(project_name='examples', task_name='Artifacts example')
|
||||||
@ -49,3 +50,7 @@ print(df)
|
|||||||
|
|
||||||
# we are done
|
# we are done
|
||||||
print('Done')
|
print('Done')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
@ -8,7 +8,11 @@ from clearml import Task
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Getting the task we want to get the artifacts from
|
# Getting the task we want to get the artifacts from
|
||||||
artifacts_task = Task.get_task(project_name='examples', task_name='Artifacts example')
|
artifacts_task = Task.get_task(
|
||||||
|
project_name='examples',
|
||||||
|
task_name='Artifacts example',
|
||||||
|
task_filter={'status': ['completed']}
|
||||||
|
)
|
||||||
|
|
||||||
# getting the numpy object back
|
# getting the numpy object back
|
||||||
numpy_artifact = artifacts_task.artifacts['Numpy Eye'].get()
|
numpy_artifact = artifacts_task.artifacts['Numpy Eye'].get()
|
||||||
|
@ -5,7 +5,6 @@ Upload artifacts from a Task, and then a different Task can access and utilize t
|
|||||||
from clearml import Task
|
from clearml import Task
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
task1 = Task.init(project_name='examples', task_name='Create artifact')
|
task1 = Task.init(project_name='examples', task_name='Create artifact')
|
||||||
# upload data file to the initialized task, inputting a name and file location
|
# upload data file to the initialized task, inputting a name and file location
|
||||||
task1.upload_artifact(name='data file', artifact_object='data_samples/sample.json')
|
task1.upload_artifact(name='data file', artifact_object='data_samples/sample.json')
|
||||||
@ -15,7 +14,8 @@ task1.close()
|
|||||||
# initialize another task to use some other task's artifacts
|
# initialize another task to use some other task's artifacts
|
||||||
task2 = Task.init(project_name='examples', task_name='Use artifact from other task')
|
task2 = Task.init(project_name='examples', task_name='Use artifact from other task')
|
||||||
# get instance of Task that created artifact (task1), using Task's project and name. You could also use its ID number.
|
# get instance of Task that created artifact (task1), using Task's project and name. You could also use its ID number.
|
||||||
preprocess_task = Task.get_task(project_name='examples', task_name='Create artifact')
|
preprocess_task = Task.get_task(project_name='examples', task_name='Create artifact',
|
||||||
|
task_filter={'status': ['completed']})
|
||||||
# access artifact from task1, using the artifact's name
|
# access artifact from task1, using the artifact's name
|
||||||
# get_local_copy() caches the files for later use and returns a path to the cached file
|
# get_local_copy() caches the files for later use and returns a path to the cached file
|
||||||
local_json = preprocess_task.artifacts['data file'].get_local_copy()
|
local_json = preprocess_task.artifacts['data file'].get_local_copy()
|
||||||
|
Loading…
Reference in New Issue
Block a user