mirror of
https://github.com/clearml/clearml
synced 2025-03-03 18:52:12 +00:00
Deprecate Task.get_by_name
This commit is contained in:
parent
75b4015fdb
commit
028a835676
@ -2807,21 +2807,6 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
||||
res = cls._send(session=session, req=req, log=log)
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def get_by_name(cls, task_name):
|
||||
# type: (str) -> Task
|
||||
"""
|
||||
Returns the most recent task with the given name from anywhere in the system as a Task object.
|
||||
|
||||
:param str task_name: The name of the task to search for.
|
||||
|
||||
:return: Task object of the most recent task with that name.
|
||||
"""
|
||||
res = cls._send(cls._get_default_session(), tasks.GetAllRequest(name=exact_match_regex(task_name)))
|
||||
|
||||
task = get_single_result(entity='task', query=task_name, results=res.response.tasks)
|
||||
return cls(task_id=task.id)
|
||||
|
||||
@classmethod
|
||||
def get_task_output_log_web_page(cls, task_id, project_id=None, app_server_host=None):
|
||||
# type: (str, Optional[str], Optional[str]) -> str
|
||||
|
@ -7,6 +7,7 @@ import signal
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import warnings
|
||||
from argparse import ArgumentParser
|
||||
from logging import getLogger
|
||||
from tempfile import mkstemp, mkdtemp
|
||||
@ -860,6 +861,23 @@ class Task(_Task):
|
||||
|
||||
return task
|
||||
|
||||
@classmethod
|
||||
def get_by_name(cls, task_name):
|
||||
# type: (str) -> TaskInstance
|
||||
"""
|
||||
|
||||
.. note::
|
||||
This method is deprecated, use :meth:`Task.get_task` instead.
|
||||
|
||||
Returns the most recent task with the given name from anywhere in the system as a Task object.
|
||||
|
||||
:param str task_name: The name of the task to search for.
|
||||
|
||||
:return: Task object of the most recent task with that name.
|
||||
"""
|
||||
warnings.warn("Warning: 'Task.get_by_name' is deprecated. Use 'Task.get_task' instead", DeprecationWarning)
|
||||
return cls.get_task(task_name=task_name)
|
||||
|
||||
@classmethod
|
||||
def get_task(
|
||||
cls,
|
||||
|
Loading…
Reference in New Issue
Block a user