Allow overriding auto_delete_file in Task.update_output_model() (#554)

This commit is contained in:
allegroai 2022-01-31 10:50:08 +02:00
parent e182c188e0
commit f45b3e3ce3

View File

@ -793,6 +793,7 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
tags=None, # type: Optional[Sequence[str]] tags=None, # type: Optional[Sequence[str]]
model_name=None, # type: Optional[str] model_name=None, # type: Optional[str]
iteration=None, # type: Optional[int] iteration=None, # type: Optional[int]
auto_delete_file=True # type: bool
): ):
# type: (...) -> str # type: (...) -> str
""" """
@ -810,6 +811,10 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
:param model_name: If provided the model name as it will appear in the model artifactory. (Optional) :param model_name: If provided the model name as it will appear in the model artifactory. (Optional)
Default: Task.name - name Default: Task.name - name
:param iteration: iteration number for the current stored model (Optional) :param iteration: iteration number for the current stored model (Optional)
:param bool auto_delete_file: Delete the temporary file after uploading (Optional)
- ``True`` - Delete (Default)
- ``False`` - Do not delete
:return: The URI of the uploaded weights file. :return: The URI of the uploaded weights file.
Notice: upload is done is a background thread, while the function call returns immediately Notice: upload is done is a background thread, while the function call returns immediately
@ -822,7 +827,9 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
comment=comment comment=comment
) )
output_model.connect(task=self, name=name) output_model.connect(task=self, name=name)
url = output_model.update_weights(weights_filename=model_path, iteration=iteration) url = output_model.update_weights(
weights_filename=model_path, iteration=iteration, auto_delete_file=auto_delete_file
)
return url return url
@property @property