Skip to content

Commit 2b868a9

Browse files
author
Robin VAN DE MERGHEL
committed
fix: Added status in vacuum case
1 parent dafa65e commit 2b868a9

File tree

6 files changed

+75
-90
lines changed
  • diracx-client/src/diracx/client/_generated/models
  • diracx-db/src/diracx/db/sql/pilots
  • diracx-logic/src/diracx/logic/pilots
  • diracx-routers/src/diracx/routers
  • extensions/gubbins/gubbins-client/src/gubbins/client/_generated/models

6 files changed

+75
-90
lines changed

diracx-client/src/diracx/client/_generated/models/_models.py

Lines changed: 9 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,13 @@ class BodyPilotsAddPilotStamps(_serialization.Model):
177177
:vartype destination_site: str
178178
:ivar pilot_references: Association of a pilot reference with a pilot stamp.
179179
:vartype pilot_references: dict[str, str]
180-
:ivar status_reason: Status reason of the pilots.
181-
:vartype status_reason: str
180+
:ivar pilot_status: Status of the pilots. Known values are: "Submitted", "Waiting", "Running",
181+
"Done", "Failed", "Deleted", "Aborted", and "Unknown".
182+
:vartype pilot_status: str or ~_generated.models.PilotStatus
182183
:ivar generate_secrets: If we want to create secrets with the pilots.
183184
:vartype generate_secrets: bool
184185
:ivar pilot_secret_use_count_max: How much time can a secret be used.
185186
:vartype pilot_secret_use_count_max: int
186-
>>>>>>> 2099d7ba (fix: Generate client)
187-
:ivar pilot_status: Status of the pilots. Known values are: "Submitted", "Waiting", "Running",
188-
"Done", "Failed", "Deleted", "Aborted", and "Unknown".
189-
:vartype pilot_status: str or ~_generated.models.PilotStatus
190187
"""
191188

192189
_validation = {
@@ -201,11 +198,9 @@ class BodyPilotsAddPilotStamps(_serialization.Model):
201198
"grid_site": {"key": "grid_site", "type": "str"},
202199
"destination_site": {"key": "destination_site", "type": "str"},
203200
"pilot_references": {"key": "pilot_references", "type": "{str}"},
204-
"status_reason": {"key": "status_reason", "type": "str"},
201+
"pilot_status": {"key": "pilot_status", "type": "str"},
205202
"generate_secrets": {"key": "generate_secrets", "type": "bool"},
206203
"pilot_secret_use_count_max": {"key": "pilot_secret_use_count_max", "type": "int"},
207-
>>>>>>> 2099d7ba (fix: Generate client)
208-
"pilot_status": {"key": "pilot_status", "type": "str"},
209204
}
210205

211206
def __init__(
@@ -217,11 +212,9 @@ def __init__(
217212
grid_site: str = "Unknown",
218213
destination_site: str = "NotAssigned",
219214
pilot_references: Optional[Dict[str, str]] = None,
220-
status_reason: str = "Unknown",
215+
pilot_status: Optional[Union[str, "_models.PilotStatus"]] = None,
221216
generate_secrets: bool = True,
222217
pilot_secret_use_count_max: int = 1,
223-
>>>>>>> 2099d7ba (fix: Generate client)
224-
pilot_status: Optional[Union[str, "_models.PilotStatus"]] = None,
225218
**kwargs: Any
226219
) -> None:
227220
"""
@@ -237,16 +230,13 @@ def __init__(
237230
:paramtype destination_site: str
238231
:keyword pilot_references: Association of a pilot reference with a pilot stamp.
239232
:paramtype pilot_references: dict[str, str]
240-
:keyword status_reason: Status reason of the pilots.
241-
:paramtype status_reason: str
233+
:keyword pilot_status: Status of the pilots. Known values are: "Submitted", "Waiting",
234+
"Running", "Done", "Failed", "Deleted", "Aborted", and "Unknown".
235+
:paramtype pilot_status: str or ~_generated.models.PilotStatus
242236
:keyword generate_secrets: If we want to create secrets with the pilots.
243237
:paramtype generate_secrets: bool
244238
:keyword pilot_secret_use_count_max: How much time can a secret be used.
245239
:paramtype pilot_secret_use_count_max: int
246-
>>>>>>> 2099d7ba (fix: Generate client)
247-
:keyword pilot_status: Status of the pilots. Known values are: "Submitted", "Waiting",
248-
"Running", "Done", "Failed", "Deleted", "Aborted", and "Unknown".
249-
:paramtype pilot_status: str or ~_generated.models.PilotStatus
250240
"""
251241
super().__init__(**kwargs)
252242
self.pilot_stamps = pilot_stamps
@@ -255,7 +245,7 @@ def __init__(
255245
self.grid_site = grid_site
256246
self.destination_site = destination_site
257247
self.pilot_references = pilot_references
258-
self.status_reason = status_reason
248+
self.pilot_status = pilot_status
259249
self.generate_secrets = generate_secrets
260250
self.pilot_secret_use_count_max = pilot_secret_use_count_max
261251

@@ -309,74 +299,6 @@ def __init__(
309299
self.vo = vo
310300

311301

312-
class BodyPilotsPerformSecretExchange(_serialization.Model):
313-
"""Body_pilots_perform_secret_exchange.
314-
315-
All required parameters must be populated in order to send to server.
316-
317-
:ivar pilot_stamp: Stamp used by a pilot to login. Required.
318-
:vartype pilot_stamp: str
319-
:ivar pilot_secret: Pilot secret given by Dirac/DiracX. Required.
320-
:vartype pilot_secret: str
321-
"""
322-
323-
_validation = {
324-
"pilot_stamp": {"required": True},
325-
"pilot_secret": {"required": True},
326-
}
327-
328-
_attribute_map = {
329-
"pilot_stamp": {"key": "pilot_stamp", "type": "str"},
330-
"pilot_secret": {"key": "pilot_secret", "type": "str"},
331-
}
332-
333-
def __init__(self, *, pilot_stamp: str, pilot_secret: str, **kwargs: Any) -> None:
334-
"""
335-
:keyword pilot_stamp: Stamp used by a pilot to login. Required.
336-
:paramtype pilot_stamp: str
337-
:keyword pilot_secret: Pilot secret given by Dirac/DiracX. Required.
338-
:paramtype pilot_secret: str
339-
"""
340-
super().__init__(**kwargs)
341-
self.pilot_stamp = pilot_stamp
342-
self.pilot_secret = pilot_secret
343-
344-
345-
class BodyPilotsRefreshPilotTokens(_serialization.Model):
346-
"""Body_pilots_refresh_pilot_tokens.
347-
348-
All required parameters must be populated in order to send to server.
349-
350-
:ivar refresh_token: Refresh Token given at login by DiracX. Required.
351-
:vartype refresh_token: str
352-
:ivar pilot_stamp: Pilot stamp. Required.
353-
:vartype pilot_stamp: str
354-
"""
355-
356-
_validation = {
357-
"refresh_token": {"required": True},
358-
"pilot_stamp": {"required": True},
359-
}
360-
361-
_attribute_map = {
362-
"refresh_token": {"key": "refresh_token", "type": "str"},
363-
"pilot_stamp": {"key": "pilot_stamp", "type": "str"},
364-
}
365-
366-
def __init__(self, *, refresh_token: str, pilot_stamp: str, **kwargs: Any) -> None:
367-
"""
368-
:keyword refresh_token: Refresh Token given at login by DiracX. Required.
369-
:paramtype refresh_token: str
370-
:keyword pilot_stamp: Pilot stamp. Required.
371-
:paramtype pilot_stamp: str
372-
"""
373-
super().__init__(**kwargs)
374-
self.refresh_token = refresh_token
375-
self.pilot_stamp = pilot_stamp
376-
>>>>>>> 2099d7ba (fix: Generate client)
377-
self.pilot_status = pilot_status
378-
379-
380302
class BodyPilotsUpdatePilotFields(_serialization.Model):
381303
"""Body_pilots_update_pilot_fields.
382304

diracx-db/src/diracx/db/sql/pilots/db.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from diracx.core.models import (
1818
PilotFieldsMapping,
1919
PilotSecretConstraints,
20+
PilotStatus,
2021
SearchSpec,
2122
SortSpec,
2223
)

diracx-logic/src/diracx/logic/pilots/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ async def verify_pilot_credentials(
187187
vo=credentials["vo"],
188188
grid_type=credentials["grid_type"],
189189
grid_site=credentials["grid_site"],
190-
# FIXME: Add status
190+
status=credentials["status"],
191191
)
192192

193193
# 1. Get the pilot

diracx-routers/src/diracx/routers/auth/pilots.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ async def perform_secret_exchange(
4646
This endpoint also acts as DIRAC's `dirac-admin-add-pilot`.
4747
"""
4848
try:
49-
# FIXME: Pilot not found
5049
return await verify_pilot_credentials(
5150
pilot_db=pilot_db,
5251
auth_db=auth_db,

diracx-routers/src/diracx/routers/pilots/management.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
PilotFieldsMapping,
1717
PilotSecretConstraints,
1818
PilotSecretsInfo,
19-
PilotStatus
19+
PilotStatus,
2020
)
2121
from diracx.logic.pilots.auth import create_secrets
2222
from diracx.logic.pilots.auth import (

extensions/gubbins/gubbins-client/src/gubbins/client/_generated/models/_models.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ class BodyPilotsAddPilotStamps(_serialization.Model):
180180
:ivar pilot_status: Status of the pilots. Known values are: "Submitted", "Waiting", "Running",
181181
"Done", "Failed", "Deleted", "Aborted", and "Unknown".
182182
:vartype pilot_status: str or ~_generated.models.PilotStatus
183+
:ivar generate_secrets: If we want to create secrets with the pilots.
184+
:vartype generate_secrets: bool
185+
:ivar pilot_secret_use_count_max: How much time can a secret be used.
186+
:vartype pilot_secret_use_count_max: int
183187
"""
184188

185189
_validation = {
@@ -195,6 +199,8 @@ class BodyPilotsAddPilotStamps(_serialization.Model):
195199
"destination_site": {"key": "destination_site", "type": "str"},
196200
"pilot_references": {"key": "pilot_references", "type": "{str}"},
197201
"pilot_status": {"key": "pilot_status", "type": "str"},
202+
"generate_secrets": {"key": "generate_secrets", "type": "bool"},
203+
"pilot_secret_use_count_max": {"key": "pilot_secret_use_count_max", "type": "int"},
198204
}
199205

200206
def __init__(
@@ -207,6 +213,8 @@ def __init__(
207213
destination_site: str = "NotAssigned",
208214
pilot_references: Optional[Dict[str, str]] = None,
209215
pilot_status: Optional[Union[str, "_models.PilotStatus"]] = None,
216+
generate_secrets: bool = True,
217+
pilot_secret_use_count_max: int = 1,
210218
**kwargs: Any
211219
) -> None:
212220
"""
@@ -225,6 +233,10 @@ def __init__(
225233
:keyword pilot_status: Status of the pilots. Known values are: "Submitted", "Waiting",
226234
"Running", "Done", "Failed", "Deleted", "Aborted", and "Unknown".
227235
:paramtype pilot_status: str or ~_generated.models.PilotStatus
236+
:keyword generate_secrets: If we want to create secrets with the pilots.
237+
:paramtype generate_secrets: bool
238+
:keyword pilot_secret_use_count_max: How much time can a secret be used.
239+
:paramtype pilot_secret_use_count_max: int
228240
"""
229241
super().__init__(**kwargs)
230242
self.pilot_stamps = pilot_stamps
@@ -234,6 +246,57 @@ def __init__(
234246
self.destination_site = destination_site
235247
self.pilot_references = pilot_references
236248
self.pilot_status = pilot_status
249+
self.generate_secrets = generate_secrets
250+
self.pilot_secret_use_count_max = pilot_secret_use_count_max
251+
252+
253+
class BodyPilotsCreatePilotSecrets(_serialization.Model):
254+
"""Body_pilots_create_pilot_secrets.
255+
256+
All required parameters must be populated in order to send to server.
257+
258+
:ivar n: Number of secrets to create. Required.
259+
:vartype n: int
260+
:ivar expiration_minutes: Time in minutes before expiring. Required.
261+
:vartype expiration_minutes: int
262+
:ivar pilot_secret_use_count_max: Number of times that we can use a secret. Required.
263+
:vartype pilot_secret_use_count_max: int
264+
:ivar vo: Only VO that can access a secret. Required.
265+
:vartype vo: str
266+
"""
267+
268+
_validation = {
269+
"n": {"required": True},
270+
"expiration_minutes": {"required": True},
271+
"pilot_secret_use_count_max": {"required": True},
272+
"vo": {"required": True},
273+
}
274+
275+
_attribute_map = {
276+
"n": {"key": "n", "type": "int"},
277+
"expiration_minutes": {"key": "expiration_minutes", "type": "int"},
278+
"pilot_secret_use_count_max": {"key": "pilot_secret_use_count_max", "type": "int"},
279+
"vo": {"key": "vo", "type": "str"},
280+
}
281+
282+
def __init__(
283+
self, *, n: int, expiration_minutes: int, pilot_secret_use_count_max: int, vo: str, **kwargs: Any
284+
) -> None:
285+
"""
286+
:keyword n: Number of secrets to create. Required.
287+
:paramtype n: int
288+
:keyword expiration_minutes: Time in minutes before expiring. Required.
289+
:paramtype expiration_minutes: int
290+
:keyword pilot_secret_use_count_max: Number of times that we can use a secret. Required.
291+
:paramtype pilot_secret_use_count_max: int
292+
:keyword vo: Only VO that can access a secret. Required.
293+
:paramtype vo: str
294+
"""
295+
super().__init__(**kwargs)
296+
self.n = n
297+
self.expiration_minutes = expiration_minutes
298+
self.pilot_secret_use_count_max = pilot_secret_use_count_max
299+
self.vo = vo
237300

238301

239302
class BodyPilotsUpdatePilotFields(_serialization.Model):

0 commit comments

Comments
 (0)