cmsdials 0.3.0__tar.gz → 0.4.0__tar.gz

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.
Files changed (41) hide show
  1. {cmsdials-0.3.0 → cmsdials-0.4.0}/PKG-INFO +10 -7
  2. {cmsdials-0.3.0 → cmsdials-0.4.0}/README.md +9 -6
  3. cmsdials-0.4.0/cmsdials/clients/file_index/models.py +36 -0
  4. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/clients/h1d/models.py +16 -17
  5. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/clients/h2d/models.py +18 -22
  6. cmsdials-0.4.0/cmsdials/clients/lumisection/client.py +9 -0
  7. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/clients/lumisection/models.py +8 -14
  8. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/clients/run/models.py +3 -11
  9. cmsdials-0.4.0/cmsdials/cmsdials.py +19 -0
  10. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/filters.py +0 -2
  11. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/utils/api_client.py +18 -5
  12. {cmsdials-0.3.0 → cmsdials-0.4.0}/pyproject.toml +1 -1
  13. cmsdials-0.3.0/cmsdials/clients/bad_file_index/client.py +0 -9
  14. cmsdials-0.3.0/cmsdials/clients/bad_file_index/models.py +0 -30
  15. cmsdials-0.3.0/cmsdials/clients/file_index/models.py +0 -44
  16. cmsdials-0.3.0/cmsdials/clients/lumisection/client.py +0 -20
  17. cmsdials-0.3.0/cmsdials/cmsdials.py +0 -19
  18. cmsdials-0.3.0/cmsdials/utils/__init__.py +0 -0
  19. {cmsdials-0.3.0 → cmsdials-0.4.0}/LICENSE +0 -0
  20. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/__init__.py +0 -0
  21. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/auth/__init__.py +0 -0
  22. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/auth/_base.py +0 -0
  23. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/auth/bearer.py +0 -0
  24. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/auth/client.py +0 -0
  25. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/auth/exceptions.py +0 -0
  26. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/auth/models.py +0 -0
  27. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/auth/secret_key.py +0 -0
  28. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/clients/__init__.py +0 -0
  29. {cmsdials-0.3.0/cmsdials/clients/bad_file_index → cmsdials-0.4.0/cmsdials/clients/file_index}/__init__.py +0 -0
  30. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/clients/file_index/client.py +0 -0
  31. {cmsdials-0.3.0/cmsdials/clients/file_index → cmsdials-0.4.0/cmsdials/clients/h1d}/__init__.py +0 -0
  32. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/clients/h1d/client.py +0 -0
  33. {cmsdials-0.3.0/cmsdials/clients/h1d → cmsdials-0.4.0/cmsdials/clients/h2d}/__init__.py +0 -0
  34. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/clients/h2d/client.py +0 -0
  35. {cmsdials-0.3.0/cmsdials/clients/h2d → cmsdials-0.4.0/cmsdials/clients/lumisection}/__init__.py +0 -0
  36. {cmsdials-0.3.0/cmsdials/clients/lumisection → cmsdials-0.4.0/cmsdials/clients/run}/__init__.py +0 -0
  37. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/clients/run/client.py +0 -0
  38. {cmsdials-0.3.0/cmsdials/clients/run → cmsdials-0.4.0/cmsdials/utils}/__init__.py +0 -0
  39. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/utils/_json.py +0 -0
  40. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/utils/base_model.py +0 -0
  41. {cmsdials-0.3.0 → cmsdials-0.4.0}/cmsdials/utils/logger.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cmsdials
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: The Python api client interface to DIALS service
5
5
  Home-page: https://github.com/cms-DQM/dials-py
6
6
  Author: Gabriel Moreira
@@ -82,6 +82,14 @@ dials = Dials(creds, nthreads=2)
82
82
  data = dials.h1d.list_all(LumisectionHistogram1DFilters(title="PixelPhase1/Tracks/PXBarrel/charge_PXLayer_2"), max_pages=5)
83
83
  ```
84
84
 
85
+ ### Workspace
86
+
87
+ Users are automatically routed to a workspace based on e-groups, but it is possible to overwrite this configuration and inspect data from others workspaces:
88
+
89
+ ```python
90
+ dials = Dials(creds, workspace="jetmet", nthreads=2)
91
+ ```
92
+
85
93
  ## Available endpoints
86
94
 
87
95
  This package interacts with DIALS api endpoints using underlying classes in `Dials` object.
@@ -89,7 +97,6 @@ This package interacts with DIALS api endpoints using underlying classes in `Dia
89
97
  ### Retrieving a specific object using `get`
90
98
 
91
99
  ```python
92
- dials.bad_file_index.get(id=1)
93
100
  dials.file_index.get(id=1)
94
101
  dials.h1d.get(id=1)
95
102
  dials.h2d.get(id=1)
@@ -102,7 +109,6 @@ dials.run.get(id=1)
102
109
  It is possible to get a list of entries from those endpoint using the `list` and `list_all` methods, the `list` method will fetch only one page and the `list_all` will fetch all available pages:
103
110
 
104
111
  ```python
105
- dials.bad_file_index.list()
106
112
  dials.file_index.list()
107
113
  dials.h1d.list()
108
114
  dials.h2d.list()
@@ -113,7 +119,6 @@ dials.run.list()
113
119
  ### Retrieving all available pages of a list of objects using `list_all`
114
120
 
115
121
  ```python
116
- dials.bad_file_index.list_all()
117
122
  dials.file_index.list_all()
118
123
  dials.h1d.list_all()
119
124
  dials.h2d.list_all()
@@ -133,7 +138,6 @@ Keep in mind that calling those methods without any filter can take a lot of tim
133
138
 
134
139
  ```python
135
140
  from cmsdials.filters import (
136
- BadFileIndexFilters,
137
141
  FileIndexFilters,
138
142
  LumisectionHistogram1DFilters,
139
143
  LumisectionHistogram2DFilters,
@@ -141,7 +145,6 @@ from cmsdials.filters import (
141
145
  RunFilters
142
146
  )
143
147
 
144
- dials.bad_file_index.list(BadFileIndexFilters(path_contains="ZeroBias"))
145
148
 
146
149
  dials.file_index.list(FileIndexFilters(page="10"))
147
150
 
@@ -173,7 +176,7 @@ from cmsdials import Dials
173
176
  from cmsdials.filters import LumisectionHistogram2DFilters
174
177
 
175
178
  DEV_URL = "http://localhost:8000/"
176
- DEV_CACHE_DIR = ".cache-dev
179
+ DEV_CACHE_DIR = ".cache-dev"
177
180
 
178
181
  auth = AuthClient(base_url=DEV_URL)
179
182
  creds = Credentials.from_creds_file(cache_dir=DEV_CACHE_DIR, client=auth) # Make sure to specify the auth client with overwritten values, using another cache_dir is recommended
@@ -59,6 +59,14 @@ dials = Dials(creds, nthreads=2)
59
59
  data = dials.h1d.list_all(LumisectionHistogram1DFilters(title="PixelPhase1/Tracks/PXBarrel/charge_PXLayer_2"), max_pages=5)
60
60
  ```
61
61
 
62
+ ### Workspace
63
+
64
+ Users are automatically routed to a workspace based on e-groups, but it is possible to overwrite this configuration and inspect data from others workspaces:
65
+
66
+ ```python
67
+ dials = Dials(creds, workspace="jetmet", nthreads=2)
68
+ ```
69
+
62
70
  ## Available endpoints
63
71
 
64
72
  This package interacts with DIALS api endpoints using underlying classes in `Dials` object.
@@ -66,7 +74,6 @@ This package interacts with DIALS api endpoints using underlying classes in `Dia
66
74
  ### Retrieving a specific object using `get`
67
75
 
68
76
  ```python
69
- dials.bad_file_index.get(id=1)
70
77
  dials.file_index.get(id=1)
71
78
  dials.h1d.get(id=1)
72
79
  dials.h2d.get(id=1)
@@ -79,7 +86,6 @@ dials.run.get(id=1)
79
86
  It is possible to get a list of entries from those endpoint using the `list` and `list_all` methods, the `list` method will fetch only one page and the `list_all` will fetch all available pages:
80
87
 
81
88
  ```python
82
- dials.bad_file_index.list()
83
89
  dials.file_index.list()
84
90
  dials.h1d.list()
85
91
  dials.h2d.list()
@@ -90,7 +96,6 @@ dials.run.list()
90
96
  ### Retrieving all available pages of a list of objects using `list_all`
91
97
 
92
98
  ```python
93
- dials.bad_file_index.list_all()
94
99
  dials.file_index.list_all()
95
100
  dials.h1d.list_all()
96
101
  dials.h2d.list_all()
@@ -110,7 +115,6 @@ Keep in mind that calling those methods without any filter can take a lot of tim
110
115
 
111
116
  ```python
112
117
  from cmsdials.filters import (
113
- BadFileIndexFilters,
114
118
  FileIndexFilters,
115
119
  LumisectionHistogram1DFilters,
116
120
  LumisectionHistogram2DFilters,
@@ -118,7 +122,6 @@ from cmsdials.filters import (
118
122
  RunFilters
119
123
  )
120
124
 
121
- dials.bad_file_index.list(BadFileIndexFilters(path_contains="ZeroBias"))
122
125
 
123
126
  dials.file_index.list(FileIndexFilters(page="10"))
124
127
 
@@ -150,7 +153,7 @@ from cmsdials import Dials
150
153
  from cmsdials.filters import LumisectionHistogram2DFilters
151
154
 
152
155
  DEV_URL = "http://localhost:8000/"
153
- DEV_CACHE_DIR = ".cache-dev
156
+ DEV_CACHE_DIR = ".cache-dev"
154
157
 
155
158
  auth = AuthClient(base_url=DEV_URL)
156
159
  creds = Credentials.from_creds_file(cache_dir=DEV_CACHE_DIR, client=auth) # Make sure to specify the auth client with overwritten values, using another cache_dir is recommended
@@ -0,0 +1,36 @@
1
+ from datetime import datetime
2
+ from typing import List, Optional
3
+
4
+ from pydantic import AnyUrl, BaseModel, Field
5
+
6
+ from ...utils.base_model import OBaseModel
7
+
8
+
9
+ class FileIndex(BaseModel):
10
+ file_id: int
11
+ file_size: int
12
+ era: str = Field(..., max_length=5)
13
+ campaign: str = Field(..., max_length=15)
14
+ primary_dataset: str = Field(..., max_length=50)
15
+ creation_date: datetime
16
+ last_modification_date: datetime
17
+ logical_file_name: str
18
+ status: str = Field(..., max_length=15)
19
+ err_trace: Optional[str] = Field(..., max_length=5000)
20
+
21
+
22
+ class PaginatedFileIndexList(BaseModel):
23
+ count: int
24
+ next: Optional[AnyUrl]
25
+ previous: Optional[AnyUrl]
26
+ results: List[FileIndex]
27
+
28
+
29
+ class FileIndexFilters(OBaseModel):
30
+ page: Optional[str] = None
31
+ min_size: Optional[int] = None
32
+ era: Optional[str] = None
33
+ campaign: Optional[str] = None
34
+ primary_dataset: Optional[str] = None
35
+ logical_file_name: Optional[str] = None
36
+ status: Optional[str] = None
@@ -1,4 +1,3 @@
1
- from datetime import datetime
2
1
  from typing import List, Optional
3
2
 
4
3
  from pydantic import AnyUrl, BaseModel, Field
@@ -7,18 +6,16 @@ from ...utils.base_model import OBaseModel
7
6
 
8
7
 
9
8
  class LumisectionHistogram1D(BaseModel):
10
- id: int
11
- ls_number: int
9
+ hist_id: int
10
+ file_id: int
12
11
  run_number: int
13
- date: datetime
12
+ ls_id: int
14
13
  title: str = Field(..., max_length=220)
15
- entries: int
16
- data: list[float]
17
14
  x_min: float
18
15
  x_max: float
19
- x_bin: int
20
- source_data_file: int
21
- lumisection: int
16
+ x_bin: float
17
+ entries: int
18
+ data: list[float]
22
19
 
23
20
 
24
21
  class PaginatedLumisectionHistogram1DList(BaseModel):
@@ -29,16 +26,18 @@ class PaginatedLumisectionHistogram1DList(BaseModel):
29
26
 
30
27
 
31
28
  class LumisectionHistogram1DFilters(OBaseModel):
32
- ls_number: Optional[int] = None
33
- lumisection_id: Optional[int] = None
34
- max_ls_number: Optional[int] = None
35
- max_run_number: Optional[int] = None
36
- min_entries: Optional[int] = None
37
- min_ls_number: Optional[int] = None
38
- min_run_number: Optional[int] = None
39
29
  page: Optional[str] = None
40
30
  run_number: Optional[int] = None
31
+ ls_number: Optional[int] = None
32
+ ls_id: Optional[int] = None
41
33
  title: Optional[str] = None
34
+ min_run_number: Optional[int] = None
35
+ max_run_number: Optional[int] = None
36
+ min_ls_number: Optional[int] = None
37
+ max_ls_number: Optional[int] = None
42
38
  title_contains: Optional[str] = None
39
+ min_entries: Optional[int] = None
43
40
  era: Optional[str] = None
44
- dqmio_filepath_contains: Optional[str] = None
41
+ campaign: Optional[str] = None
42
+ primary_dataset: Optional[str] = None
43
+ file_id: Optional[int] = None
@@ -1,4 +1,3 @@
1
- from datetime import datetime
2
1
  from typing import Optional
3
2
 
4
3
  from pydantic import AnyUrl, BaseModel, Field
@@ -7,24 +6,19 @@ from ...utils.base_model import OBaseModel
7
6
 
8
7
 
9
8
  class LumisectionHistogram2D(BaseModel):
10
- id: int
11
- ls_number: int
9
+ hist_id: int
10
+ file_id: int
12
11
  run_number: int
13
- date: datetime
12
+ ls_id: int
14
13
  title: str = Field(..., max_length=220)
15
- entries: int
16
- data: list[list[float]]
17
14
  x_min: float
18
15
  x_max: float
19
- x_bin: int
20
- y_max: float
16
+ x_bin: float
21
17
  y_min: float
22
- y_bin: int
23
- source_data_file: int = Field(
24
- ...,
25
- description="Source data file that the specific Histogram was read from, if any",
26
- )
27
- lumisection: int
18
+ y_max: float
19
+ y_bin: float
20
+ entries: int
21
+ data: list[float]
28
22
 
29
23
 
30
24
  class PaginatedLumisectionHistogram2DList(BaseModel):
@@ -35,16 +29,18 @@ class PaginatedLumisectionHistogram2DList(BaseModel):
35
29
 
36
30
 
37
31
  class LumisectionHistogram2DFilters(OBaseModel):
38
- ls_number: Optional[int] = None
39
- lumisection_id: Optional[int] = None
40
- max_ls_number: Optional[int] = None
41
- max_run_number: Optional[int] = None
42
- min_entries: Optional[int] = None
43
- min_ls_number: Optional[int] = None
44
- min_run_number: Optional[int] = None
45
32
  page: Optional[str] = None
46
33
  run_number: Optional[int] = None
34
+ ls_number: Optional[int] = None
35
+ ls_id: Optional[int] = None
47
36
  title: Optional[str] = None
37
+ min_run_number: Optional[int] = None
38
+ max_run_number: Optional[int] = None
39
+ min_ls_number: Optional[int] = None
40
+ max_ls_number: Optional[int] = None
48
41
  title_contains: Optional[str] = None
42
+ min_entries: Optional[int] = None
49
43
  era: Optional[str] = None
50
- dqmio_filepath_contains: Optional[str] = None
44
+ campaign: Optional[str] = None
45
+ primary_dataset: Optional[str] = None
46
+ file_id: Optional[int] = None
@@ -0,0 +1,9 @@
1
+ from ...utils.api_client import BaseAuthorizedAPIClient
2
+ from .models import Lumisection, LumisectionFilters, PaginatedLumisectionList
3
+
4
+
5
+ class LumisectionClient(BaseAuthorizedAPIClient):
6
+ data_model = Lumisection
7
+ pagination_model = PaginatedLumisectionList
8
+ filter_class = LumisectionFilters
9
+ lookup_url = "lumisection/"
@@ -1,5 +1,4 @@
1
- from datetime import datetime
2
- from typing import List, Optional
1
+ from typing import Optional
3
2
 
4
3
  from pydantic import AnyUrl, BaseModel
5
4
 
@@ -7,11 +6,10 @@ from ...utils.base_model import OBaseModel
7
6
 
8
7
 
9
8
  class Lumisection(BaseModel):
10
- id: int
9
+ ls_id: int
11
10
  ls_number: int
12
- date: datetime
13
- oms_zerobias_rate: Optional[float]
14
- run: int
11
+ th1_count: int
12
+ th2_count: int
15
13
 
16
14
 
17
15
  class PaginatedLumisectionList(BaseModel):
@@ -22,14 +20,10 @@ class PaginatedLumisectionList(BaseModel):
22
20
 
23
21
 
24
22
  class LumisectionFilters(OBaseModel):
23
+ page: Optional[str] = None
24
+ run_number: Optional[int] = None
25
25
  ls_number: Optional[int] = None
26
- max_ls_number: Optional[int] = None
27
- max_run_number: Optional[int] = None
28
26
  min_ls_number: Optional[int] = None
27
+ max_ls_number: Optional[int] = None
29
28
  min_run_number: Optional[int] = None
30
- page: Optional[str] = None
31
- run_number: Optional[int] = None
32
-
33
-
34
- class ConfiguredMEs(BaseModel):
35
- mes: List[str]
29
+ max_run_number: Optional[int] = None
@@ -1,21 +1,13 @@
1
- from datetime import datetime
2
1
  from typing import Optional
3
2
 
4
- from pydantic import AnyUrl, BaseModel, Field
3
+ from pydantic import AnyUrl, BaseModel
5
4
 
6
5
  from ...utils.base_model import OBaseModel
7
6
 
8
7
 
9
8
  class Run(BaseModel):
10
9
  run_number: int
11
- run_date: Optional[datetime]
12
- year: Optional[int]
13
- period: Optional[str] = Field(..., max_length=1)
14
- date: datetime
15
- oms_fill: Optional[int]
16
- oms_lumisections: Optional[int]
17
- oms_initial_lumi: Optional[float]
18
- oms_end_lumi: Optional[float]
10
+ ls_count: int
19
11
 
20
12
 
21
13
  class PaginatedRunList(BaseModel):
@@ -26,6 +18,6 @@ class PaginatedRunList(BaseModel):
26
18
 
27
19
 
28
20
  class RunFilters(OBaseModel):
21
+ page: Optional[str] = None
29
22
  max_run_number: Optional[int] = None
30
23
  min_run_number: Optional[int] = None
31
- page: Optional[str] = None
@@ -0,0 +1,19 @@
1
+ from typing import Optional
2
+
3
+ from .auth._base import BaseCredentials
4
+ from .clients.file_index.client import FileIndexClient
5
+ from .clients.h1d.client import LumisectionHistogram1DClient
6
+ from .clients.h2d.client import LumisectionHistogram2DClient
7
+ from .clients.lumisection.client import LumisectionClient
8
+ from .clients.run.client import RunClient
9
+
10
+
11
+ class Dials:
12
+ def __init__(
13
+ self, creds: BaseCredentials, workspace: Optional[str] = None, nthreads: Optional[int] = None, *args, **kwargs
14
+ ) -> None:
15
+ self.file_index = FileIndexClient(creds, workspace, nthreads, *args, **kwargs)
16
+ self.h1d = LumisectionHistogram1DClient(creds, workspace, nthreads, *args, **kwargs)
17
+ self.h2d = LumisectionHistogram2DClient(creds, workspace, nthreads, *args, **kwargs)
18
+ self.lumi = LumisectionClient(creds, workspace, nthreads, *args, **kwargs)
19
+ self.run = RunClient(creds, workspace, nthreads, *args, **kwargs)
@@ -1,4 +1,3 @@
1
- from .clients.bad_file_index.models import BadFileIndexFilters
2
1
  from .clients.file_index.models import FileIndexFilters
3
2
  from .clients.h1d.models import LumisectionHistogram1DFilters
4
3
  from .clients.h2d.models import LumisectionHistogram2DFilters
@@ -6,7 +5,6 @@ from .clients.lumisection.models import LumisectionFilters
6
5
  from .clients.run.models import RunFilters
7
6
 
8
7
  __all__ = [
9
- "BadFileIndexFilters",
10
8
  "FileIndexFilters",
11
9
  "LumisectionHistogram1DFilters",
12
10
  "LumisectionHistogram2DFilters",
@@ -38,15 +38,29 @@ class BaseAuthorizedAPIClient(BaseAPIClient):
38
38
  filter_class = None
39
39
  lookup_url = None
40
40
 
41
- def __init__(self, creds: BaseCredentials, nthreads: Optional[int] = None, *args: str, **kwargs: str) -> None:
41
+ def __init__(
42
+ self,
43
+ creds: BaseCredentials,
44
+ workspace: Optional[str] = None,
45
+ nthreads: Optional[int] = None,
46
+ *args: str,
47
+ **kwargs: str,
48
+ ) -> None:
42
49
  super().__init__(*args, **kwargs)
43
50
  self.creds = creds
51
+ self.workspace = workspace
44
52
  self.nthreads = nthreads or 1
45
53
 
54
+ def __build_headers(self) -> dict:
55
+ base = {"accept": "application/json"}
56
+ if self.workspace is not None:
57
+ base["Workspace"] = self.workspace
58
+ self.creds.before_request(base)
59
+ return base
60
+
46
61
  def get(self, id: str):
47
62
  endpoint_url = self.api_url + self.lookup_url + str(id) + "/"
48
- headers = {"accept": "application/json"}
49
- self.creds.before_request(headers)
63
+ headers = self.__build_headers()
50
64
  response = requests.get(endpoint_url, headers=headers)
51
65
 
52
66
  try:
@@ -61,8 +75,7 @@ class BaseAuthorizedAPIClient(BaseAPIClient):
61
75
  def list(self, filters=None):
62
76
  filters = filters or self.filter_class()
63
77
  endpoint_url = self.api_url + self.lookup_url
64
- headers = {"accept": "application/json"}
65
- self.creds.before_request(headers)
78
+ headers = self.__build_headers()
66
79
  response = requests.get(endpoint_url, headers=headers, params=filters.cleandict())
67
80
 
68
81
  try:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cmsdials"
3
- version = "0.3.0"
3
+ version = "0.4.0"
4
4
  description = "The Python api client interface to DIALS service"
5
5
  authors = ["Gabriel Moreira <gabrielmscampos@gmail.com>"]
6
6
  readme = "README.md"
@@ -1,9 +0,0 @@
1
- from ...utils.api_client import BaseAuthorizedAPIClient
2
- from .models import BadFileIndex, BadFileIndexFilters, PaginatedBadFileIndexList
3
-
4
-
5
- class BadFileIndexClient(BaseAuthorizedAPIClient):
6
- data_model = BadFileIndex
7
- pagination_model = PaginatedBadFileIndexList
8
- filter_class = BadFileIndexFilters
9
- lookup_url = "bad-file-index/"
@@ -1,30 +0,0 @@
1
- from datetime import datetime
2
- from typing import List, Optional
3
-
4
- from pydantic import AnyUrl, BaseModel, Field
5
-
6
- from ...utils.base_model import OBaseModel
7
-
8
-
9
- class BadFileIndex(BaseModel):
10
- id: int
11
- file_path: str = Field(..., description="Path where the file is stored", max_length=255)
12
- data_era: str = Field(..., description="The era that the data refers to (e.g. 2018A)", max_length=7)
13
- st_size: float = Field(..., description="The data file's size in bytes")
14
- st_ctime: datetime = Field(..., description="Time of files's last status change in filesystem")
15
- st_itime: datetime = Field(..., description="Time when file was indexed in database")
16
- err: str = Field(..., description="Error message", max_length=255)
17
-
18
-
19
- class PaginatedBadFileIndexList(BaseModel):
20
- count: int
21
- next: Optional[AnyUrl]
22
- previous: Optional[AnyUrl]
23
- results: List[BadFileIndex]
24
-
25
-
26
- class BadFileIndexFilters(OBaseModel):
27
- era: Optional[str] = None
28
- min_size: Optional[float] = None
29
- page: Optional[str] = None
30
- path_contains: Optional[str] = None
@@ -1,44 +0,0 @@
1
- from datetime import datetime
2
- from typing import List, Optional
3
-
4
- from pydantic import AnyUrl, BaseModel, Field
5
-
6
- from ...utils.base_model import OBaseModel
7
-
8
-
9
- class FileIndex(BaseModel):
10
- id: int
11
- file_uuid: str = Field(..., description="ROOT TFile UUID", max_length=36)
12
- file_path: str = Field(..., description="Path where the file is stored", max_length=255)
13
- data_era: str = Field(..., description="The era that the data refers to (e.g. 2018A)", max_length=7)
14
- n_entries: int = Field(
15
- ...,
16
- description="Total number of entries contained in this histogram file",
17
- )
18
- n_entries_ingested: int = Field(
19
- ...,
20
- description="Number of histogram entries that have been extracted from the file",
21
- )
22
- st_size: float = Field(..., description="The data file's size in bytes")
23
- st_ctime: datetime = Field(..., description="Time of files's last status change in filesystem")
24
- st_itime: datetime = Field(..., description="Time when file was indexed in database")
25
- status: str = Field(
26
- ...,
27
- description="Indicate the processing status of run-histogram within the file",
28
- max_length=9,
29
- )
30
-
31
-
32
- class PaginatedFileIndexList(BaseModel):
33
- count: int
34
- next: Optional[AnyUrl]
35
- previous: Optional[AnyUrl]
36
- results: List[FileIndex]
37
-
38
-
39
- class FileIndexFilters(OBaseModel):
40
- era: Optional[str] = None
41
- min_size: Optional[float] = None
42
- page: Optional[str] = None
43
- path_contains: Optional[str] = None
44
- status: Optional[str] = None
@@ -1,20 +0,0 @@
1
- import requests
2
-
3
- from ...utils.api_client import BaseAuthorizedAPIClient
4
- from .models import ConfiguredMEs, Lumisection, LumisectionFilters, PaginatedLumisectionList
5
-
6
-
7
- class LumisectionClient(BaseAuthorizedAPIClient):
8
- data_model = Lumisection
9
- pagination_model = PaginatedLumisectionList
10
- filter_class = LumisectionFilters
11
- lookup_url = "lumisection/"
12
-
13
- def configured_mes(self):
14
- endpoint_url = self.api_url + self.lookup_url + "configured-mes/"
15
- headers = {"accept": "application/json"}
16
- self.creds.before_request(headers)
17
- response = requests.get(endpoint_url, headers=headers)
18
- response.raise_for_status()
19
- response = response.json()
20
- return ConfiguredMEs(**response)
@@ -1,19 +0,0 @@
1
- from typing import Optional
2
-
3
- from .auth._base import BaseCredentials
4
- from .clients.bad_file_index.client import BadFileIndexClient
5
- from .clients.file_index.client import FileIndexClient
6
- from .clients.h1d.client import LumisectionHistogram1DClient
7
- from .clients.h2d.client import LumisectionHistogram2DClient
8
- from .clients.lumisection.client import LumisectionClient
9
- from .clients.run.client import RunClient
10
-
11
-
12
- class Dials:
13
- def __init__(self, creds: BaseCredentials, nthreads: Optional[int] = None, *args, **kwargs) -> None:
14
- self.bad_file_index = BadFileIndexClient(creds, nthreads, *args, **kwargs)
15
- self.file_index = FileIndexClient(creds, nthreads, *args, **kwargs)
16
- self.h1d = LumisectionHistogram1DClient(creds, nthreads, *args, **kwargs)
17
- self.h2d = LumisectionHistogram2DClient(creds, nthreads, *args, **kwargs)
18
- self.lumi = LumisectionClient(creds, nthreads, *args, **kwargs)
19
- self.run = RunClient(creds, nthreads, *args, **kwargs)
File without changes
File without changes
File without changes