|
| _db |
| Reference to the database object to use for queries.
|
|
| _dry_run |
| If we're in dry run mode be less critical about globaltag states (just show warnings) but refuse to do any actual update.
|
|
| _valid_from |
| First valid run for the update.
|
|
| _mode |
| True if we want to allow payloads in the staging tag to be closed, for example when retireing a payload.
|
|
| _allow_closed |
| Do we allow closed iovs in staging?
|
|
| _fix_closed |
| Do we want to automatically open closed iovs?
|
|
| _staging_coverage |
| Dictionary mapping payload names in the staging tag to the coverage they have in the staging tag, filled by check_staging_tag.
|
|
| _operations |
| Operations for the update, filled by calculate_update()
|
|
| _running_info |
| Globaltag information for the running tag.
|
|
| _staging_info |
| Globaltag information for the staging tag.
|
|
| _running_payloads |
| Payloads currently in the running tag.
|
|
| _staging_payloads |
| Payloads currently in the staging tag.
|
|
| _staging_first_iovs |
| First iov per payload name in staging to not close and open the same revision.
|
|
Calculate and apply the necessary changes to update a running globaltag
For this we take two globaltags: the running one and a staging one
containing all the payloads and iovs to be added to the running tag. We then
1. Make sure they are in the correct states (RUNNING and VALIDATED)
2. Make sure all payloads in the running tag start and end (except for open
iovs) before the given ``valid_from`` run
3. Make sure the staging tag is overlap and gap free
4. Make all payloads in staging start at either 0,0 or on/after the given
``valid_from`` run
5. Make sure all payloads in staging are unbound unless the mode is
``ALLOW_CLOSED`` or ``FIX_CLOSED``. In case of ``FIX_CLOSED`` extend the
last iov to infinity
6. Close all payloads to be updated in the running tag that are open just
before the validity in the staging tag.
Definition at line 55 of file runningupdate.py.
def __init__ |
( |
|
self, |
|
|
|
db, |
|
|
|
running, |
|
|
|
staging, |
|
|
|
valid_from, |
|
|
|
mode, |
|
|
|
dry_run = False |
|
) |
| |
Initialize the class
Arguments:
db (ConditionsDB): reference to the database object
running (str): name of the running tag
stagin (str): name of the staging tag
valid_from (tuple(int,int)): first valid exp,run
mode (RunningTagUpdateMode): the mode of the update
dry_run (bool): If true only check, don't do anything.
But be more lenient with globaltag state of staging.
Definition at line 74 of file runningupdate.py.
74 def __init__(self, db, running, staging, valid_from, mode, dry_run=False):
75 """Initialize the class
78 db (ConditionsDB): reference to the database object
79 running (str): name of the running tag
80 stagin (str): name of the staging tag
81 valid_from (tuple(int,int)): first valid exp,run
82 mode (RunningTagUpdateMode): the mode of the update
83 dry_run (bool): If true only check, don't do anything.
84 But be more lenient with globaltag state of staging.
91 valid_from = tuple(map(int, valid_from))
92 if len(valid_from) != 2:
93 raise ValueError(
"exp,run number needs to have two elements")
94 except Exception
as e:
95 raise RunningTagUpdaterError(
"No first valid run for the update specified", error=str(e))
from e
99 self._dry_run = dry_run
101 self._valid_from = valid_from
107 self._allow_closed = mode
in (RunningTagUpdateMode.ALLOW_CLOSED, RunningTagUpdateMode.FIX_CLOSED,
108 RunningTagUpdateMode.FULL_REPLACEMENT)
110 self._fix_closed = (mode == RunningTagUpdateMode.FIX_CLOSED)
113 self._staging_coverage =
None
115 self._operations =
None
118 self._running_info = db.get_globalTagInfo(running)
120 self._staging_info = db.get_globalTagInfo(staging)
122 self._check_state(running, self._running_info,
"RUNNING")
123 self._check_state(staging, self._staging_info,
"VALIDATED")
127 self._running_payloads = db.get_all_iovs(self._running_info[
'name'])
129 self._staging_payloads = db.get_all_iovs(self._staging_info[
'name'])
131 self._staging_first_iovs = {}