Definition at line 20 of file tags.py.
◆ __init__()
None python.tags.DefectsDBTagsMixin.__init__ |
( |
|
self | ) |
|
Definition at line 21 of file tags.py.
22 super(DefectsDBTagsMixin, self).
__init__()
24 self.check_tag_validity()
◆ _tag_head_and_lock()
None python.tags.DefectsDBTagsMixin._tag_head_and_lock |
( |
|
self, |
|
|
cool.IFolder |
folder, |
|
|
str |
name, |
|
|
str |
description |
|
) |
| |
|
private |
Give the current HEAD of `folder` a new tag and lock it.
Definition at line 52 of file tags.py.
52 def _tag_head_and_lock(self, folder: cool.IFolder, name: str, description: str) ->
None:
54 Give the current HEAD of `folder` a new tag and lock it.
56 LOCKED = cool.HvsTagLock.LOCKED
57 aname = name.encode(
'ascii')
58 folder.cloneTagAsUserTag(
'HEAD', aname, description.encode(
'utf-8'))
59 folder.setTagLockStatus(aname, LOCKED)
◆ check_tag_validity()
None python.tags.DefectsDBTagsMixin.check_tag_validity |
( |
|
self | ) |
|
Ensure that the tags that this DefectsDB instance was constructed with
are functional
Definition at line 110 of file tags.py.
110 def check_tag_validity(self) -> None:
112 Ensure that the tags that this DefectsDB instance was constructed with
115 if not (self.defects_tag_valid
or self.logics_tag_valid):
116 raise InvalidTagError(
"Tag doesn't resolve: {0}".
format(self._tag))
◆ defects_tag()
str python.tags.DefectsDBTagsMixin.defects_tag |
( |
|
self | ) |
|
Return the tag used for retrieving defects on this DefectsDB instance
Definition at line 119 of file tags.py.
119 def defects_tag(self) -> str:
121 Return the tag used for retrieving defects on this DefectsDB instance
123 if self._tag.defects ==
"HEAD":
return "HEAD"
125 return self.defects_folder.resolveTag(self._tag.defects)
128 raise InvalidDefectTagError(self._tag.defects)
130 return self._tag.defects
◆ defects_tag_valid()
bool python.tags.DefectsDBTagsMixin.defects_tag_valid |
( |
|
self | ) |
|
Definition at line 93 of file tags.py.
93 def defects_tag_valid(self) -> bool:
96 except InvalidTagError:
◆ defects_tags()
List[str] python.tags.DefectsDBTagsMixin.defects_tags |
( |
|
self | ) |
|
Returns a list of existing defect tags
Definition at line 34 of file tags.py.
34 def defects_tags(self) -> List[str]:
36 Returns a list of existing defect tags
38 return [
str(t)
for t
in self.defects_folder.listTags()]
◆ logics_tag()
str python.tags.DefectsDBTagsMixin.logics_tag |
( |
|
self | ) |
|
Return the tag used for retrieving virtual defect clauses
Definition at line 133 of file tags.py.
133 def logics_tag(self) -> str:
135 Return the tag used for retrieving virtual defect clauses
137 if self._tag.logic ==
"HEAD":
return "HEAD"
139 return self.defect_logic_folder.resolveTag(self._tag.logic)
142 raise InvalidLogicTagError(self._tag.logic)
144 return self._tag.logic
◆ logics_tag_valid()
bool python.tags.DefectsDBTagsMixin.logics_tag_valid |
( |
|
self | ) |
|
Definition at line 102 of file tags.py.
102 def logics_tag_valid(self) -> bool:
105 except InvalidTagError:
◆ logics_tags()
List[str] python.tags.DefectsDBTagsMixin.logics_tags |
( |
|
self | ) |
|
Returns a list of existing logic tags
Definition at line 27 of file tags.py.
27 def logics_tags(self) -> List[str]:
29 Returns a list of existing logic tags
31 return [
str(t)
for t
in self.defect_logic_folder.listTags()]
◆ new_defects_tag()
str python.tags.DefectsDBTagsMixin.new_defects_tag |
( |
|
self, |
|
|
str |
name, |
|
|
str |
description, |
|
|
Optional[Iterable] |
iovranges = None |
|
) |
| |
Clones the current DEFECTS tag (specified in the constructor) to a new one
If iovranges != None, does the slower thing of copying IOVs one by one
Parameters:
`name` : Name of the new tag
`description` : Description of the contents of this tag
Definition at line 175 of file tags.py.
175 def new_defects_tag(self, name: str, description: str, iovranges: Optional[Iterable] =
None) -> str:
177 Clones the current DEFECTS tag (specified in the constructor) to a new one
178 If iovranges != None, does the slower thing of copying IOVs one by one
181 `name` : Name of the new tag
182 `description` : Description of the contents of this tag
184 if name.startswith(
"DetStatus"):
185 raise RuntimeError(
"Only specify the last part of the defect tag")
186 adescription = description.encode(
'utf-8')
188 log.info(
"Creating new tag %s", name)
190 name = f
"DetStatusDEFECTS-{name}"
191 aname = name.encode(
'ascii')
193 if iovranges
is None:
194 self.defects_folder.cloneTagAsUserTag(self.defects_tag.
encode(
'ascii'), aname, adescription)
198 kwargs = dict(primary_only=
True, nonpresent=
True, intersect=
True)
199 iovsets = (self.retrieve(*iovrange, **kwargs)
for iovrange
in iovranges)
200 to_copy = IOVSet.from_iovsets(iovsets)
202 log.info(
"Copying IoVs: %r", to_copy)
204 with self.storage_buffer:
206 self._insert_iov(iov, name)
210 self.defects_folder.setTagDescription(aname, adescription)
◆ new_hierarchical_tag()
str python.tags.DefectsDBTagsMixin.new_hierarchical_tag |
( |
|
self, |
|
|
str |
defects_tag, |
|
|
str |
logics_tag |
|
) |
| |
Create a new heirarchical tag relating the defects and logics
New tag is of the form
"DetStatus-[Logic revision number]-[Defect tagname]"
and has description
"(v%i) blah"
Definition at line 61 of file tags.py.
61 def new_hierarchical_tag(self, defects_tag: str, logics_tag: str) -> str:
63 Create a new heirarchical tag relating the defects and logics
65 New tag is of the form
66 "DetStatus-[Logic revision number]-[Defect tagname]"
70 logic_revision =
int(logics_tag.split(
"-")[-1])
71 defect_part =
"-".
join(defects_tag.split(
"-")[1:])
72 hierarchical_tag =
"DetStatus-v%02i-%s" % (logic_revision, defect_part)
73 logicspart =
"(%i) " % logic_revision
75 adefects_tag = defects_tag.encode(
'ascii')
76 alogics_tag = logics_tag.encode(
'ascii')
77 ahierarchical_tag = hierarchical_tag.encode(
'ascii')
78 logicspart = logicspart.encode(
'ascii')
79 defect_descr = self.defects_folder.tagDescription(adefects_tag).
encode(
'utf-8')
82 description = logicspart + defect_descr[:255 - len(logicspart)]
84 parent_folder = self.parent_folderset
85 self.defects_folder.createTagRelation(ahierarchical_tag, adefects_tag)
86 self.defect_logic_folder.createTagRelation(ahierarchical_tag, alogics_tag)
87 parent_folder.setTagDescription(ahierarchical_tag, description)
89 log.info(
"New hierarchical tag %s", hierarchical_tag)
90 return hierarchical_tag
◆ new_logics_tag()
str python.tags.DefectsDBTagsMixin.new_logics_tag |
( |
|
self, |
|
|
str |
description = "" |
|
) |
| |
Create a new tag for the logic folder and lock it.
Parameters:
`description` : What changed in this tag? (optional, default "")
Definition at line 160 of file tags.py.
160 def new_logics_tag(self, description: str =
"") -> str:
162 Create a new tag for the logic folder and lock it.
165 `description` : What changed in this tag? (optional, default "")
167 assert self.logics_tag ==
"HEAD", NONHEAD_MODIFICATION_MSG
169 new_tag_name = self.next_logics_tag
170 folder = self.defect_logic_folder
171 self._tag_head_and_lock(folder, new_tag_name, description)
172 log.info(
"Tagged DEFECTLOGICS HEAD with %s", new_tag_name)
◆ next_logics_tag()
str python.tags.DefectsDBTagsMixin.next_logics_tag |
( |
|
self | ) |
|
Gives the next available DEFECTLOGICS tag
Definition at line 41 of file tags.py.
41 def next_logics_tag(self) -> str:
43 Gives the next available DEFECTLOGICS tag
45 existing_tags = self.logics_tags
47 new_id =
max(
int(
str(t).
split(
"-")[-1])
for t
in existing_tags) + 1
50 return DEFECT_LOGIC_TAG_FORMAT % new_id
◆ tag()
tagtype python.tags.DefectsDBTagsMixin.tag |
( |
|
self | ) |
|
Readonly property stating the tag that the database was instantiated on
Definition at line 147 of file tags.py.
147 def tag(self) -> tagtype:
149 Readonly property stating the tag that the database was instantiated on
◆ tags()
List[str] python.tags.DefectsDBTagsMixin.tags |
( |
|
self | ) |
|
The list of tags which are on the database
Definition at line 154 of file tags.py.
154 def tags(self) -> List[str]:
156 The list of tags which are on the database
158 return [
str(t)
for t
in self.parent_folderset.listTags()]
◆ logics_tag
python.tags.DefectsDBTagsMixin.logics_tag |
The documentation for this class was generated from the following file: