diracx-db 0.0.1a8__tar.gz → 0.0.1a10__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/PKG-INFO +1 -1
  2. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/pyproject.toml +3 -0
  3. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/os/utils.py +3 -3
  4. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/jobs/db.py +12 -10
  5. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/jobs/schema.py +0 -14
  6. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/sandbox_metadata/db.py +2 -1
  7. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/sandbox_metadata/schema.py +1 -0
  8. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx_db.egg-info/PKG-INFO +1 -1
  9. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/README.md +0 -0
  10. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/setup.cfg +0 -0
  11. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/__init__.py +0 -0
  12. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/__main__.py +0 -0
  13. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/exceptions.py +0 -0
  14. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/os/__init__.py +0 -0
  15. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/os/job_parameters.py +0 -0
  16. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/py.typed +0 -0
  17. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/__init__.py +0 -0
  18. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/auth/__init__.py +0 -0
  19. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/auth/db.py +0 -0
  20. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/auth/schema.py +0 -0
  21. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/dummy/__init__.py +0 -0
  22. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/dummy/db.py +0 -0
  23. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/dummy/schema.py +0 -0
  24. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/jobs/__init__.py +0 -0
  25. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/jobs/status_utility.py +0 -0
  26. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/sandbox_metadata/__init__.py +0 -0
  27. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx/db/sql/utils.py +0 -0
  28. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx_db.egg-info/SOURCES.txt +0 -0
  29. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx_db.egg-info/dependency_links.txt +0 -0
  30. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx_db.egg-info/entry_points.txt +0 -0
  31. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx_db.egg-info/requires.txt +0 -0
  32. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/src/diracx_db.egg-info/top_level.txt +0 -0
  33. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/tests/auth/test_authorization_flow.py +0 -0
  34. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/tests/auth/test_device_flow.py +0 -0
  35. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/tests/auth/test_refresh_token.py +0 -0
  36. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/tests/jobs/test_jobDB.py +0 -0
  37. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/tests/jobs/test_jobLoggingDB.py +0 -0
  38. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/tests/opensearch/test_connection.py +0 -0
  39. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/tests/opensearch/test_index_template.py +0 -0
  40. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/tests/opensearch/test_search.py +0 -0
  41. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/tests/test_dummyDB.py +0 -0
  42. {diracx-db-0.0.1a8 → diracx-db-0.0.1a10}/tests/test_sandbox_metadata.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diracx-db
3
- Version: 0.0.1a8
3
+ Version: 0.0.1a10
4
4
  Summary: TODO
5
5
  License: GPL-3.0-only
6
6
  Classifier: Intended Audience :: Science/Research
@@ -56,3 +56,6 @@ addopts = [
56
56
  "--import-mode=importlib",
57
57
  ]
58
58
  asyncio_mode = "auto"
59
+ markers = [
60
+ "enabled_dependencies: List of dependencies which should be available to the FastAPI test client",
61
+ ]
@@ -17,8 +17,6 @@ from diracx.core.exceptions import InvalidQueryError
17
17
  from diracx.core.extensions import select_from_extension
18
18
  from diracx.db.exceptions import DBUnavailable
19
19
 
20
- OS_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S.%f%z"
21
-
22
20
  logger = logging.getLogger(__name__)
23
21
 
24
22
 
@@ -184,7 +182,9 @@ class BaseOSDB(metaclass=ABCMeta):
184
182
  if field_name not in self.fields:
185
183
  continue
186
184
  if self.fields[field_name]["type"] == "date":
187
- hit[field_name] = datetime.strptime(hit[field_name], OS_DATE_FORMAT)
185
+ hit[field_name] = datetime.strptime(
186
+ hit[field_name], "%Y-%m-%dT%H:%M:%S.%f%z"
187
+ )
188
188
 
189
189
  return hits
190
190
 
@@ -388,7 +388,7 @@ class JobDB(BaseSQLDB):
388
388
  classAdJob.insertAttributeInt("JobID", job_id)
389
389
 
390
390
  try:
391
- result = self._checkAndPrepareJob(
391
+ result = await self._checkAndPrepareJob(
392
392
  job_id,
393
393
  classAdJob,
394
394
  classAdReq,
@@ -421,11 +421,9 @@ class JobDB(BaseSQLDB):
421
421
 
422
422
  jobAttrs["ApplicationStatus"] = "Unknown"
423
423
 
424
- jobAttrs["ApplicationNumStatus"] = 0
424
+ jobAttrs["LastUpdateTime"] = datetime.now(tz=timezone.utc)
425
425
 
426
- jobAttrs["LastUpdateTime"] = str(datetime.utcnow())
427
-
428
- jobAttrs["RescheduleTime"] = str(datetime.utcnow())
426
+ jobAttrs["RescheduleTime"] = datetime.now(tz=timezone.utc)
429
427
 
430
428
  reqJDL = classAdReq.asJDL()
431
429
  classAdJob.insertAttributeInt("JobRequirements", reqJDL)
@@ -435,9 +433,9 @@ class JobDB(BaseSQLDB):
435
433
  # Replace the JobID placeholder if any
436
434
  jobJDL = jobJDL.replace("%j", str(job_id))
437
435
 
438
- result = self.setJobJDL(job_id, jobJDL)
436
+ result = await self.setJobJDL(job_id, jobJDL)
439
437
 
440
- result = self.setJobAttributes(job_id, jobAttrs)
438
+ result = await self.setJobAttributes(job_id, jobAttrs)
441
439
 
442
440
  retVal["InputData"] = classAdJob.lookupAttribute("InputData")
443
441
  retVal["RescheduleCounter"] = reschedule_counter
@@ -669,9 +667,13 @@ class TaskQueueDB(BaseSQLDB):
669
667
  """
670
668
  Get the task queue info for given jobs
671
669
  """
672
- stmt = select(
673
- TaskQueues.TQId, TaskQueues.Owner, TaskQueues.OwnerGroup, TaskQueues.VO
674
- ).where(JobsQueue.JobId.in_(job_ids))
670
+ stmt = (
671
+ select(
672
+ TaskQueues.TQId, TaskQueues.Owner, TaskQueues.OwnerGroup, TaskQueues.VO
673
+ )
674
+ .join(JobsQueue, TaskQueues.TQId == JobsQueue.TQId)
675
+ .where(JobsQueue.JobId.in_(job_ids))
676
+ )
675
677
  return set(
676
678
  (int(row[0]), str(row[1]), str(row[2]), str(row[3]))
677
679
  for row in (await self.conn.execute(stmt)).all()
@@ -60,10 +60,6 @@ class Jobs(JobDBBase):
60
60
  )
61
61
  JobType = Column("JobType", String(32), default="user")
62
62
  JobGroup = Column("JobGroup", String(32), default="00000000")
63
- JobSplitType = Column(
64
- "JobSplitType", Enum("Single", "Master", "Subjob", "DAGNode"), default="Single"
65
- )
66
- MasterJobID = Column("MasterJobID", Integer, default=0)
67
63
  Site = Column("Site", String(100), default="ANY")
68
64
  JobName = Column("JobName", String(128), default="Unknown")
69
65
  Owner = Column("Owner", String(64), default="Unknown")
@@ -78,17 +74,9 @@ class Jobs(JobDBBase):
78
74
  Status = Column("Status", String(32), default="Received")
79
75
  MinorStatus = Column("MinorStatus", String(128), default="Unknown")
80
76
  ApplicationStatus = Column("ApplicationStatus", String(255), default="Unknown")
81
- ApplicationNumStatus = Column("ApplicationNumStatus", Integer, default=0)
82
77
  UserPriority = Column("UserPriority", Integer, default=0)
83
- SystemPriority = Column("SystemPriority", Integer, default=0)
84
78
  RescheduleCounter = Column("RescheduleCounter", Integer, default=0)
85
79
  VerifiedFlag = Column("VerifiedFlag", EnumBackedBool(), default=False)
86
- DeletedFlag = Column("DeletedFlag", EnumBackedBool(), default=False)
87
- KilledFlag = Column("KilledFlag", EnumBackedBool(), default=False)
88
- FailedFlag = Column("FailedFlag", EnumBackedBool(), default=False)
89
- ISandboxReadyFlag = Column("ISandboxReadyFlag", EnumBackedBool(), default=False)
90
- OSandboxReadyFlag = Column("OSandboxReadyFlag", EnumBackedBool(), default=False)
91
- RetrievedFlag = Column("RetrievedFlag", EnumBackedBool(), default=False)
92
80
  # TODO: Should this be True/False/"Failed"? Or True/False/Null?
93
81
  AccountedFlag = Column(
94
82
  "AccountedFlag", Enum("True", "False", "Failed"), default="False"
@@ -97,7 +85,6 @@ class Jobs(JobDBBase):
97
85
  __table_args__ = (
98
86
  Index("JobType", "JobType"),
99
87
  Index("JobGroup", "JobGroup"),
100
- Index("JobSplitType", "JobSplitType"),
101
88
  Index("Site", "Site"),
102
89
  Index("Owner", "Owner"),
103
90
  Index("OwnerGroup", "OwnerGroup"),
@@ -212,7 +199,6 @@ class TaskQueues(TaskQueueDBBase):
212
199
  __tablename__ = "tq_TaskQueues"
213
200
  TQId = Column(Integer, primary_key=True)
214
201
  Owner = Column(String(255), nullable=False)
215
- OwnerDN = Column(String(255))
216
202
  OwnerGroup = Column(String(32), nullable=False)
217
203
  VO = Column(String(32), nullable=False)
218
204
  CPUTime = Column(BigInteger, nullable=False)
@@ -19,7 +19,7 @@ class SandboxMetadataDB(BaseSQLDB):
19
19
  stmt = sqlalchemy.select(sb_Owners.OwnerID).where(
20
20
  sb_Owners.Owner == user.preferred_username,
21
21
  sb_Owners.OwnerGroup == user.dirac_group,
22
- # TODO: Add VO
22
+ sb_Owners.VO == user.vo,
23
23
  )
24
24
  result = await self.conn.execute(stmt)
25
25
  if owner_id := result.scalar_one_or_none():
@@ -28,6 +28,7 @@ class SandboxMetadataDB(BaseSQLDB):
28
28
  stmt = sqlalchemy.insert(sb_Owners).values(
29
29
  Owner=user.preferred_username,
30
30
  OwnerGroup=user.dirac_group,
31
+ VO=user.vo,
31
32
  )
32
33
  result = await self.conn.execute(stmt)
33
34
  return result.lastrowid
@@ -19,6 +19,7 @@ class sb_Owners(Base):
19
19
  OwnerID = Column(Integer, autoincrement=True)
20
20
  Owner = Column(String(32))
21
21
  OwnerGroup = Column(String(32))
22
+ VO = Column(String(64))
22
23
  __table_args__ = (PrimaryKeyConstraint("OwnerID"),)
23
24
 
24
25
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diracx-db
3
- Version: 0.0.1a8
3
+ Version: 0.0.1a10
4
4
  Summary: TODO
5
5
  License: GPL-3.0-only
6
6
  Classifier: Intended Audience :: Science/Research
File without changes
File without changes