rucio-clients 32.8.6__py3-none-any.whl → 35.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rucio-clients might be problematic. Click here for more details.
- rucio/__init__.py +0 -1
- rucio/alembicrevision.py +1 -2
- rucio/client/__init__.py +0 -1
- rucio/client/accountclient.py +45 -25
- rucio/client/accountlimitclient.py +37 -9
- rucio/client/baseclient.py +199 -154
- rucio/client/client.py +2 -3
- rucio/client/configclient.py +19 -6
- rucio/client/credentialclient.py +9 -4
- rucio/client/didclient.py +238 -63
- rucio/client/diracclient.py +13 -5
- rucio/client/downloadclient.py +162 -51
- rucio/client/exportclient.py +4 -4
- rucio/client/fileclient.py +3 -4
- rucio/client/importclient.py +4 -4
- rucio/client/lifetimeclient.py +21 -5
- rucio/client/lockclient.py +18 -8
- rucio/client/{metaclient.py → metaconventionsclient.py} +18 -15
- rucio/client/pingclient.py +0 -1
- rucio/client/replicaclient.py +15 -5
- rucio/client/requestclient.py +35 -19
- rucio/client/rseclient.py +133 -51
- rucio/client/ruleclient.py +29 -22
- rucio/client/scopeclient.py +8 -6
- rucio/client/subscriptionclient.py +47 -35
- rucio/client/touchclient.py +8 -4
- rucio/client/uploadclient.py +166 -82
- rucio/common/__init__.py +0 -1
- rucio/common/cache.py +4 -4
- rucio/common/config.py +52 -47
- rucio/common/constants.py +69 -2
- rucio/common/constraints.py +0 -1
- rucio/common/didtype.py +24 -22
- rucio/common/exception.py +281 -222
- rucio/common/extra.py +0 -1
- rucio/common/logging.py +54 -38
- rucio/common/pcache.py +122 -101
- rucio/common/plugins.py +153 -0
- rucio/common/policy.py +4 -4
- rucio/common/schema/__init__.py +17 -10
- rucio/common/schema/atlas.py +7 -5
- rucio/common/schema/belleii.py +7 -5
- rucio/common/schema/domatpc.py +7 -5
- rucio/common/schema/escape.py +7 -5
- rucio/common/schema/generic.py +8 -6
- rucio/common/schema/generic_multi_vo.py +7 -5
- rucio/common/schema/icecube.py +7 -5
- rucio/common/stomp_utils.py +0 -1
- rucio/common/stopwatch.py +0 -1
- rucio/common/test_rucio_server.py +2 -2
- rucio/common/types.py +262 -17
- rucio/common/utils.py +743 -451
- rucio/rse/__init__.py +3 -4
- rucio/rse/protocols/__init__.py +0 -1
- rucio/rse/protocols/bittorrent.py +184 -0
- rucio/rse/protocols/cache.py +1 -2
- rucio/rse/protocols/dummy.py +1 -2
- rucio/rse/protocols/gfal.py +12 -10
- rucio/rse/protocols/globus.py +7 -7
- rucio/rse/protocols/gsiftp.py +2 -3
- rucio/rse/protocols/http_cache.py +1 -2
- rucio/rse/protocols/mock.py +1 -2
- rucio/rse/protocols/ngarc.py +1 -2
- rucio/rse/protocols/posix.py +12 -13
- rucio/rse/protocols/protocol.py +116 -52
- rucio/rse/protocols/rclone.py +6 -7
- rucio/rse/protocols/rfio.py +4 -5
- rucio/rse/protocols/srm.py +9 -10
- rucio/rse/protocols/ssh.py +8 -9
- rucio/rse/protocols/storm.py +2 -3
- rucio/rse/protocols/webdav.py +17 -14
- rucio/rse/protocols/xrootd.py +23 -17
- rucio/rse/rsemanager.py +19 -7
- rucio/vcsversion.py +4 -4
- rucio/version.py +5 -13
- rucio_clients-35.8.0.data/data/requirements.client.txt +15 -0
- {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/rucio_client/merge_rucio_configs.py +2 -5
- {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/scripts/rucio +87 -85
- {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/scripts/rucio-admin +45 -32
- {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/METADATA +13 -13
- rucio_clients-35.8.0.dist-info/RECORD +88 -0
- {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/WHEEL +1 -1
- {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/licenses/AUTHORS.rst +3 -0
- rucio/common/schema/cms.py +0 -478
- rucio/common/schema/lsst.py +0 -423
- rucio_clients-32.8.6.data/data/requirements.txt +0 -55
- rucio_clients-32.8.6.dist-info/RECORD +0 -88
- {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/etc/rse-accounts.cfg.template +0 -0
- {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/etc/rucio.cfg.atlas.client.template +0 -0
- {rucio_clients-32.8.6.data → rucio_clients-35.8.0.data}/data/etc/rucio.cfg.template +0 -0
- {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/licenses/LICENSE +0 -0
- {rucio_clients-32.8.6.dist-info → rucio_clients-35.8.0.dist-info}/top_level.txt +0 -0
rucio/common/extra.py
CHANGED
rucio/common/logging.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
1
|
# Copyright European Organization for Nuclear Research (CERN) since 2012
|
|
3
2
|
#
|
|
4
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -21,12 +20,15 @@ import re
|
|
|
21
20
|
import sys
|
|
22
21
|
from collections.abc import Callable, Iterator, Mapping, Sequence
|
|
23
22
|
from traceback import format_tb
|
|
24
|
-
from typing import TYPE_CHECKING, Any, Optional
|
|
23
|
+
from typing import TYPE_CHECKING, Any, Literal, Optional, Union, get_args
|
|
25
24
|
|
|
26
25
|
from rucio.common.config import config_get, config_get_bool
|
|
27
26
|
|
|
28
27
|
if TYPE_CHECKING:
|
|
29
|
-
from logging import LogRecord
|
|
28
|
+
from logging import LogRecord, _SysExcInfoType
|
|
29
|
+
|
|
30
|
+
from _typeshed import OptExcInfo
|
|
31
|
+
from flask import Flask
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
# Mapping from ECS field paths
|
|
@@ -34,24 +36,40 @@ if TYPE_CHECKING:
|
|
|
34
36
|
# https://www.elastic.co/guide/en/ecs/8.5/ecs-field-reference.html
|
|
35
37
|
# to python log record attributes:
|
|
36
38
|
# https://docs.python.org/3/library/logging.html#logrecord-attributes
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
ECS_FIELDS = Literal[
|
|
40
|
+
'@timestamp',
|
|
41
|
+
'message',
|
|
42
|
+
'log.level',
|
|
43
|
+
'log.origin.function',
|
|
44
|
+
'log.origin.file.line',
|
|
45
|
+
'log.origin.file.name',
|
|
46
|
+
'log.logger',
|
|
47
|
+
'process.pid',
|
|
48
|
+
'process.name',
|
|
49
|
+
'process.thread.id',
|
|
50
|
+
'process.thread.name'
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
LOG_RECORDS = Literal[
|
|
54
|
+
'asctime',
|
|
55
|
+
'message',
|
|
56
|
+
'levelname',
|
|
57
|
+
'funcName',
|
|
58
|
+
'lineno',
|
|
59
|
+
'filename',
|
|
60
|
+
'name',
|
|
61
|
+
'process',
|
|
62
|
+
'processName',
|
|
63
|
+
'thread',
|
|
64
|
+
'threadName'
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
BUILTIN_FIELDS: tuple[tuple[ECS_FIELDS, LOG_RECORDS], ...] = tuple((x, y) for x, y in zip(get_args(ECS_FIELDS), get_args(LOG_RECORDS)))
|
|
68
|
+
ECS_TO_LOG_RECORD_MAP: dict[ECS_FIELDS, LOG_RECORDS] = dict(BUILTIN_FIELDS)
|
|
69
|
+
LOG_RECORD_TO_ECS_MAP: dict[LOG_RECORDS, ECS_FIELDS] = dict((f[1], f[0]) for f in BUILTIN_FIELDS)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _json_serializable(obj: Any) -> Union[dict[Any, Any], str]:
|
|
55
73
|
try:
|
|
56
74
|
return obj.__dict__
|
|
57
75
|
except AttributeError:
|
|
@@ -161,11 +179,11 @@ def _timestamp_formatter(record_formatter: "LogDataSource", record: "LogRecord")
|
|
|
161
179
|
yield record_formatter.ecs_fields[0], datetime.datetime.utcfromtimestamp(record.created).isoformat(timespec='milliseconds') + 'Z'
|
|
162
180
|
|
|
163
181
|
|
|
164
|
-
def _ecs_field_to_record_attribute(field_name):
|
|
182
|
+
def _ecs_field_to_record_attribute(field_name: Union[ECS_FIELDS, str]) -> Union[LOG_RECORDS, str]:
|
|
165
183
|
"""
|
|
166
184
|
Sanitize the path-like field name into a symbol which can be the name of an object attribute.
|
|
167
185
|
"""
|
|
168
|
-
record = ECS_TO_LOG_RECORD_MAP.get(field_name)
|
|
186
|
+
record = ECS_TO_LOG_RECORD_MAP.get(field_name) # type: ignore
|
|
169
187
|
if record:
|
|
170
188
|
return record
|
|
171
189
|
return field_name.replace('-', '_').replace('.', '_')
|
|
@@ -196,7 +214,7 @@ class LogDataSource:
|
|
|
196
214
|
def __str__(self):
|
|
197
215
|
return self.__class__.__name__ + '(' + ', '.join(self.ecs_fields) + ')'
|
|
198
216
|
|
|
199
|
-
def format(self, record: "LogRecord"):
|
|
217
|
+
def format(self, record: "LogRecord") -> Optional[Iterator[tuple[str, Any]]]:
|
|
200
218
|
if not self._formatter:
|
|
201
219
|
return
|
|
202
220
|
for field_name, field_value in self._formatter(self, record):
|
|
@@ -213,7 +231,7 @@ class MessageLogDataSource(LogDataSource):
|
|
|
213
231
|
)
|
|
214
232
|
|
|
215
233
|
@staticmethod
|
|
216
|
-
def _get_exc_info(record):
|
|
234
|
+
def _get_exc_info(record: "LogRecord") -> Optional[Union["OptExcInfo", "_SysExcInfoType"]]:
|
|
217
235
|
exc_info = record.exc_info
|
|
218
236
|
if not exc_info:
|
|
219
237
|
return None
|
|
@@ -223,7 +241,7 @@ class MessageLogDataSource(LogDataSource):
|
|
|
223
241
|
return exc_info
|
|
224
242
|
return None
|
|
225
243
|
|
|
226
|
-
def format(self, record: "LogRecord"):
|
|
244
|
+
def format(self, record: "LogRecord") -> Iterator[tuple[str, Optional[str]]]:
|
|
227
245
|
exc_info = self._get_exc_info(record)
|
|
228
246
|
message = record.getMessage()
|
|
229
247
|
error_type, error_message, stack_trace = None, None, None
|
|
@@ -254,11 +272,11 @@ class ConstantStrDataSource(LogDataSource):
|
|
|
254
272
|
Prints a constant string for the given ECS field.
|
|
255
273
|
"""
|
|
256
274
|
|
|
257
|
-
def __init__(self, ecs_field, _str):
|
|
275
|
+
def __init__(self, ecs_field: ECS_FIELDS, _str: str):
|
|
258
276
|
log_record = ECS_TO_LOG_RECORD_MAP.get(ecs_field, None)
|
|
259
277
|
self._str = _str
|
|
260
278
|
|
|
261
|
-
def _formatter(data_source: LogDataSource, record: "LogRecord"):
|
|
279
|
+
def _formatter(data_source: LogDataSource, record: "LogRecord") -> Iterator[tuple[str, str]]:
|
|
262
280
|
yield self.ecs_fields[0], self._str
|
|
263
281
|
|
|
264
282
|
super().__init__(ecs_fields=(ecs_field,), formatter=_formatter, dst_record_attr=log_record)
|
|
@@ -285,7 +303,7 @@ class RucioFormatter(logging.Formatter):
|
|
|
285
303
|
fmt: Optional[str] = None,
|
|
286
304
|
validate: Optional[bool] = None,
|
|
287
305
|
output_json: bool = False,
|
|
288
|
-
additional_fields: Optional[Mapping[
|
|
306
|
+
additional_fields: Optional[Mapping[ECS_FIELDS, str]] = None
|
|
289
307
|
):
|
|
290
308
|
_kwargs = {}
|
|
291
309
|
if validate is not None:
|
|
@@ -345,15 +363,15 @@ class RucioFormatter(logging.Formatter):
|
|
|
345
363
|
self.output_json = output_json
|
|
346
364
|
super().__init__(fmt=fmt, style='%', **_kwargs)
|
|
347
365
|
|
|
348
|
-
def format(self, record):
|
|
349
|
-
json_record = dict(itertools.chain.from_iterable(f.format(record) for f in self._desired_data_sources))
|
|
366
|
+
def format(self, record: "LogRecord") -> str:
|
|
367
|
+
json_record = dict(itertools.chain.from_iterable(f.format(record) for f in self._desired_data_sources)) # type: ignore
|
|
350
368
|
if self.output_json:
|
|
351
369
|
return self._to_json(_unflatten_dict(json_record))
|
|
352
370
|
else:
|
|
353
371
|
return super().format(record)
|
|
354
372
|
|
|
355
373
|
@staticmethod
|
|
356
|
-
def _to_json(record):
|
|
374
|
+
def _to_json(record: dict[str, Any]) -> str:
|
|
357
375
|
try:
|
|
358
376
|
return json.dumps(record, default=_json_serializable)
|
|
359
377
|
except (TypeError, ValueError, OverflowError):
|
|
@@ -363,7 +381,7 @@ class RucioFormatter(logging.Formatter):
|
|
|
363
381
|
return '{}'
|
|
364
382
|
|
|
365
383
|
|
|
366
|
-
def rucio_log_formatter(process_name: Optional[str] = None):
|
|
384
|
+
def rucio_log_formatter(process_name: Optional[str] = None) -> RucioFormatter:
|
|
367
385
|
config_logformat = config_get('common', 'logformat', raise_exception=False, default='%(asctime)s\t%(name)s\t%(process)d\t%(levelname)s\t%(message)s')
|
|
368
386
|
output_json = config_get_bool('common', 'logjson', default=False)
|
|
369
387
|
additional_fields = {}
|
|
@@ -372,7 +390,7 @@ def rucio_log_formatter(process_name: Optional[str] = None):
|
|
|
372
390
|
return RucioFormatter(fmt=config_logformat, output_json=output_json, additional_fields=additional_fields)
|
|
373
391
|
|
|
374
392
|
|
|
375
|
-
def setup_logging(application=None, process_name=None):
|
|
393
|
+
def setup_logging(application: Optional["Flask"] = None, process_name: Optional[str] = None) -> None:
|
|
376
394
|
"""
|
|
377
395
|
Configures the logging by setting the output stream to stdout and
|
|
378
396
|
configures log level and log format.
|
|
@@ -388,17 +406,15 @@ def setup_logging(application=None, process_name=None):
|
|
|
388
406
|
application.logger.addHandler(stdouthandler)
|
|
389
407
|
|
|
390
408
|
|
|
391
|
-
def formatted_logger(innerfunc, formatstr="%s"):
|
|
409
|
+
def formatted_logger(innerfunc: Callable, formatstr: str = "%s") -> Callable:
|
|
392
410
|
"""
|
|
393
411
|
Decorates the passed function, formatting log input by
|
|
394
412
|
the passed formatstr. The format string must always include a %s.
|
|
395
413
|
|
|
396
414
|
:param innerfunc: function to be decorated. Must take (level, msg) arguments.
|
|
397
|
-
:type innerfunc: Callable
|
|
398
415
|
:param formatstr: format string with %s as placeholder.
|
|
399
|
-
:type formatstr: str
|
|
400
416
|
"""
|
|
401
417
|
@functools.wraps(innerfunc)
|
|
402
|
-
def log_format(level, msg, *args, **kwargs):
|
|
418
|
+
def log_format(level: int, msg: object, *args, **kwargs) -> Callable:
|
|
403
419
|
return innerfunc(level, formatstr % msg, *args, **kwargs)
|
|
404
420
|
return log_format
|