Support ignoring default_output_uri on remote runs when output_uri=False was specified and the backend task data has no output_uri specified

This commit is contained in:
allegroai 2023-11-07 17:03:11 +02:00
parent 1e5992cd5a
commit 9d5c39aac3

View File

@ -331,7 +331,9 @@ class Task(_Task):
:param str output_uri: The default location for output models and other artifacts. If True, the default :param str output_uri: The default location for output models and other artifacts. If True, the default
files_server will be used for model storage. In the default location, ClearML creates a subfolder for the files_server will be used for model storage. In the default location, ClearML creates a subfolder for the
output. The subfolder structure is the following: `<output destination name> / <project name> / <task name>.<Task ID>`. output. If set to False, local runs will not upload output models and artifacts,
and remote runs will not use any default values provided using ``default_output_uri``.
The subfolder structure is the following: `<output destination name> / <project name> / <task name>.<Task ID>`.
Note that for cloud storage, you must install the **ClearML** package for your cloud storage type, Note that for cloud storage, you must install the **ClearML** package for your cloud storage type,
and then configure your storage credentials. For detailed information, see "Storage" in the ClearML and then configure your storage credentials. For detailed information, see "Storage" in the ClearML
Documentation. Documentation.
@ -606,10 +608,14 @@ class Task(_Task):
task_id=get_remote_task_id(), task_id=get_remote_task_id(),
log_to_backend=False, log_to_backend=False,
) )
if task.get_project_object().default_output_destination and not task.output_uri: if output_uri is False and not task.output_uri:
task.output_uri = task.get_project_object().default_output_destination # Setting output_uri=False argument will disable using any default when running remotely
if cls.__default_output_uri and not task.output_uri: pass
task.output_uri = cls.__default_output_uri else:
if task.get_project_object().default_output_destination and not task.output_uri:
task.output_uri = task.get_project_object().default_output_destination
if cls.__default_output_uri and not task.output_uri:
task.output_uri = cls.__default_output_uri
# store new task ID # store new task ID
cls.__update_master_pid_task(task=task) cls.__update_master_pid_task(task=task)
# make sure we are started # make sure we are started
@ -1389,7 +1395,7 @@ class Task(_Task):
:return: The number of tasks enqueued in the given queue :return: The number of tasks enqueued in the given queue
""" """
if not Session.check_min_api_server_version("2.20"): if not Session.check_min_api_server_version("2.20", raise_error=True):
raise ValueError("You version of clearml-server does not support the 'queues.get_num_entries' endpoint") raise ValueError("You version of clearml-server does not support the 'queues.get_num_entries' endpoint")
mutually_exclusive(queue_name=queue_name, queue_id=queue_id) mutually_exclusive(queue_name=queue_name, queue_id=queue_id)
session = cls._get_default_session() session = cls._get_default_session()