mirror of
https://github.com/clearml/clearml-server
synced 2025-06-26 23:15:47 +00:00
Allow enqueueing stopped tasks
More clearml stuff
This commit is contained in:
parent
4b11a6efcd
commit
8f646043bb
@ -116,6 +116,7 @@ state_machine = {
|
|||||||
TaskStatus.closed,
|
TaskStatus.closed,
|
||||||
TaskStatus.created,
|
TaskStatus.created,
|
||||||
TaskStatus.failed,
|
TaskStatus.failed,
|
||||||
|
TaskStatus.queued,
|
||||||
TaskStatus.in_progress,
|
TaskStatus.in_progress,
|
||||||
TaskStatus.published,
|
TaskStatus.published,
|
||||||
TaskStatus.publishing,
|
TaskStatus.publishing,
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import functools
|
import functools
|
||||||
import itertools
|
import itertools
|
||||||
from concurrent.futures.thread import ThreadPoolExecutor
|
from concurrent.futures.thread import ThreadPoolExecutor
|
||||||
from operator import itemgetter
|
from typing import Optional, Callable, Dict, Any, Set, Iterable
|
||||||
from typing import Sequence, Optional, Callable, Tuple, Dict, Any, Set, Iterable
|
|
||||||
|
|
||||||
from boltons import iterutils
|
from boltons import iterutils
|
||||||
|
|
||||||
@ -10,24 +9,6 @@ from apiserver.database.model import AttributedDocument
|
|||||||
from apiserver.database.model.settings import Settings
|
from apiserver.database.model.settings import Settings
|
||||||
|
|
||||||
|
|
||||||
def extract_properties_to_lists(
|
|
||||||
key_names: Sequence[str],
|
|
||||||
data: Sequence[dict],
|
|
||||||
extract_func: Optional[Callable[[dict], Tuple]] = None,
|
|
||||||
) -> dict:
|
|
||||||
"""
|
|
||||||
Given a list of dictionaries and names of dictionary keys
|
|
||||||
builds a dictionary with the requested keys and values lists
|
|
||||||
:param key_names: names of the keys in the resulting dictionary
|
|
||||||
:param data: sequence of dictionaries to extract values from
|
|
||||||
:param extract_func: the optional callable that extracts properties
|
|
||||||
from a dictionary and put them in a tuple in the order corresponding to
|
|
||||||
key_names. If not specified then properties are extracted according to key_names
|
|
||||||
"""
|
|
||||||
value_sequences = zip(*map(extract_func or itemgetter(*key_names), data))
|
|
||||||
return dict(zip(key_names, map(list, value_sequences)))
|
|
||||||
|
|
||||||
|
|
||||||
class SetFieldsResolver:
|
class SetFieldsResolver:
|
||||||
"""
|
"""
|
||||||
The class receives set fields dictionary
|
The class receives set fields dictionary
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
default_expiration_sec: 2592000
|
default_expiration_sec: 2592000
|
||||||
|
|
||||||
# cookie containing auth token, for requests arriving from a web-browser
|
# cookie containing auth token, for requests arriving from a web-browser
|
||||||
session_auth_cookie_name: "trains_token_basic"
|
session_auth_cookie_name: "clearml_token_basic"
|
||||||
|
|
||||||
# cookie configuration for authorization cookies generated by auth.login
|
# cookie configuration for authorization cookies generated by auth.login
|
||||||
cookies {
|
cookies {
|
||||||
@ -116,9 +116,9 @@
|
|||||||
# Check for updates every 24 hours
|
# Check for updates every 24 hours
|
||||||
check_interval_sec: 86400
|
check_interval_sec: 86400
|
||||||
|
|
||||||
url: "https://updates.trains.allegro.ai/updates"
|
url: "https://updates.clear.ml/updates"
|
||||||
|
|
||||||
component_name: "trains-server"
|
component_name: "clearml-server"
|
||||||
|
|
||||||
# GET request timeout
|
# GET request timeout
|
||||||
request_timeout_sec: 3.0
|
request_timeout_sec: 3.0
|
||||||
@ -128,7 +128,7 @@
|
|||||||
# Note: statistics are sent ONLY if the user has actively opted-in
|
# Note: statistics are sent ONLY if the user has actively opted-in
|
||||||
supported: true
|
supported: true
|
||||||
|
|
||||||
url: "https://updates.trains.allegro.ai/stats"
|
url: "https://updates.clear.ml/stats"
|
||||||
|
|
||||||
report_interval_hours: 24
|
report_interval_hours: 24
|
||||||
agent_relevant_threshold_days: 30
|
agent_relevant_threshold_days: 30
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
backupCount: 3
|
backupCount: 3
|
||||||
maxBytes: 10240000,
|
maxBytes: 10240000,
|
||||||
class: "logging.handlers.RotatingFileHandler",
|
class: "logging.handlers.RotatingFileHandler",
|
||||||
filename: "/var/log/trains/apiserver.log"
|
filename: "/var/log/clearml/apiserver.log"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root {
|
root {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from jsonmodels.fields import BoolField
|
||||||
|
|
||||||
from apiserver.apimodels.login import (
|
from apiserver.apimodels.login import (
|
||||||
GetSupportedModesRequest,
|
GetSupportedModesRequest,
|
||||||
GetSupportedModesResponse,
|
GetSupportedModesResponse,
|
||||||
@ -6,12 +8,12 @@ from apiserver.apimodels.login import (
|
|||||||
ServerErrors,
|
ServerErrors,
|
||||||
)
|
)
|
||||||
from apiserver.config import info
|
from apiserver.config import info
|
||||||
from apiserver.service_repo import endpoint
|
from apiserver.service_repo import endpoint, APICall
|
||||||
from apiserver.service_repo.auth.fixed_user import FixedUser
|
from apiserver.service_repo.auth.fixed_user import FixedUser
|
||||||
|
|
||||||
|
|
||||||
@endpoint("login.supported_modes", response_data_model=GetSupportedModesResponse)
|
@endpoint("login.supported_modes", response_data_model=GetSupportedModesResponse)
|
||||||
def supported_modes(_, __, ___: GetSupportedModesRequest):
|
def supported_modes(call: APICall, _, __: GetSupportedModesRequest):
|
||||||
guest_user = FixedUser.get_guest_user()
|
guest_user = FixedUser.get_guest_user()
|
||||||
if guest_user:
|
if guest_user:
|
||||||
guest = BasicGuestMode(
|
guest = BasicGuestMode(
|
||||||
@ -31,4 +33,5 @@ def supported_modes(_, __, ___: GetSupportedModesRequest):
|
|||||||
missed_es_upgrade=info.missed_es_upgrade,
|
missed_es_upgrade=info.missed_es_upgrade,
|
||||||
es_connection_error=info.es_connection_error,
|
es_connection_error=info.es_connection_error,
|
||||||
),
|
),
|
||||||
|
authenticated=call.auth is not None,
|
||||||
)
|
)
|
||||||
|
@ -213,3 +213,16 @@ class TestTasksEdit(TestService):
|
|||||||
False,
|
False,
|
||||||
)
|
)
|
||||||
self.assertFalse(task_in_queue)
|
self.assertFalse(task_in_queue)
|
||||||
|
|
||||||
|
def test_stopped_task_enqueue(self):
|
||||||
|
queue_id = self.new_queue()
|
||||||
|
task_id = self.new_task()
|
||||||
|
self.api.tasks.started(task=task_id)
|
||||||
|
self.api.tasks.stopped(task=task_id)
|
||||||
|
projection = ["*", "execution.*"]
|
||||||
|
task = self.api.tasks.get_all_ex(id=task_id, projection=projection).tasks[0]
|
||||||
|
self.assertEqual(task.status, "stopped")
|
||||||
|
self.api.tasks.enqueue(task=task_id, queue=queue_id)
|
||||||
|
task = self.api.tasks.get_all_ex(id=task_id, projection=projection).tasks[0]
|
||||||
|
self.assertEqual(task.status, "queued")
|
||||||
|
self.assertEqual(task.execution.queue, queue_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user