Sandbox Metadata Database
Sandbox file metadata and tracking database.
Database Schema
schema
Attributes
Base = declarative_base()
module-attribute
Classes
SBOwners
Bases: Base
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/schema.py
Attributes
OwnerID = Column(Integer, autoincrement=True)
class-attribute
instance-attribute
Owner = Column(String(32))
class-attribute
instance-attribute
OwnerGroup = Column(String(32))
class-attribute
instance-attribute
VO = Column(String(64))
class-attribute
instance-attribute
SandBoxes
Bases: Base
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/schema.py
Attributes
SBId = Column(Integer, autoincrement=True)
class-attribute
instance-attribute
OwnerId = Column(Integer)
class-attribute
instance-attribute
SEName = Column(String(64))
class-attribute
instance-attribute
SEPFN = Column(String(512))
class-attribute
instance-attribute
Bytes = Column(BigInteger)
class-attribute
instance-attribute
RegistrationTime = DateNowColumn()
class-attribute
instance-attribute
LastAccessTime = DateNowColumn()
class-attribute
instance-attribute
Assigned = Column(Boolean, default=False)
class-attribute
instance-attribute
SBEntityMapping
Bases: Base
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/schema.py
Attributes
SBId = Column(Integer)
class-attribute
instance-attribute
EntityId = Column(String(128))
class-attribute
instance-attribute
Type = Column(String(64))
class-attribute
instance-attribute
Database Access Layer
db
Attributes
logger = logging.getLogger(__name__)
module-attribute
Classes
SandboxMetadataDB
Bases: BaseSQLDB
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
Attributes
metadata = SandboxMetadataDBBase.metadata
class-attribute
instance-attribute
Functions
get_owner_id(user)
async
Get the id of the owner from the database.
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
get_sandbox_owner_id(pfn, se_name)
async
Get the id of the owner of a sandbox.
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
insert_owner(user)
async
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
get_pfn(bucket_name, user, sandbox_info)
staticmethod
Get the sandbox's user namespaced and content addressed PFN.
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
insert_sandbox(owner_id, se_name, pfn, size)
async
Add a new sandbox in SandboxMetadataDB.
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
update_sandbox_last_access_time(se_name, pfn)
async
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
sandbox_is_assigned(pfn, se_name)
async
Checks if a sandbox exists and has been assigned.
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
jobid_to_entity_id(job_id)
staticmethod
Define the entity id as 'Entity:entity_id' due to the DB definition.
get_sandbox_assigned_to_job(job_id, sb_type)
async
Get the sandbox assign to job.
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
assign_sandbox_to_jobs(jobs_ids, pfn, sb_type, se_name)
async
Map sandbox and jobs.
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
unassign_sandboxes_to_jobs(jobs_ids)
async
Delete mapping between jobs and sandboxes.
Source code in diracx-db/src/diracx/db/sql/sandbox_metadata/db.py
delete_unused_sandboxes(*, limit=None)
async
Get the sandbox PFNs to delete.
The result of this function can be used as an async context manager to yield the PFNs of the sandboxes to delete. The context manager will automatically remove the sandboxes from the database upon exit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int | None
|
If not None, the maximum number of sandboxes to delete. |
None
|