本文整理汇总了Python中nitrate.config.log.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了info函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _fetch
def _fetch(self, inset=None):
""" Fetch case runs from the server """
# If data initialized from the inset ---> we're done
if Container._fetch(self, inset): return
# Fetch test case runs from the server
log.info("Fetching {0}'s case runs".format(self._identifier))
try:
injects = self._teiid.run_case_runs(self.id)
except teiid.TeiidNotConfigured:
injects = self._server.TestRun.get_test_case_runs(self.id)
except psycopg2.DatabaseError as error:
log.debug("Failed to fetch data from Teiid: {0}".format(error))
injects = self._server.TestRun.get_test_case_runs(self.id)
# Feed the TestRun.testcases container with the initial object
# set if all cases are already cached (saving unnecesary fetch)
testcaseids = [inject["case_id"] for inject in injects]
if (not RunCases._is_cached(self._object.testcases) and
TestCase._is_cached(testcaseids)):
self._object.testcases._fetch([TestCase(id) for id in testcaseids])
# And finally create the initial object set
self._current = set([CaseRun(inject, testcaseinject=testcase)
for inject in injects
for testcase in self._object.testcases._items
if int(inject["case_id"]) == testcase.id])
self._original = set(self._current)
开发者ID:mirekfranc,项目名称:python-nitrate,代码行数:25,代码来源:containers.py
示例2: _fetch
def _fetch(self, inset=None):
""" Fetch currently linked test cases from the server """
# If data initialized from the inset ---> we're done
if Container._fetch(self, inset):
return
# Initialize all plan-case tags (skip when caching persistently
# as this an additional/unnecessary call in that case)
if config.get_cache_level() == config.CACHE_OBJECTS:
log.info("Fetching tags for all {0}'s test cases".format(self._object.identifier))
for tag in self._server.TestPlan.get_all_cases_tags(self.id):
Tag(tag)
# Fetch test cases from the server
log.info("Fetching {0}'s cases".format(self._identifier))
injects = self._server.TestPlan.get_test_cases(self.id)
log.data("Fetched {0}".format(listed(injects, "inject")))
self._current = set([TestCase(inject) for inject in injects])
self._original = set(self._current)
# Initialize case plans if not already cached
if not PlanCasePlans._is_cached(self._object.caseplans):
inset = [
CasePlan(
{
# Fake our own internal id from testplan & testcase
"id": _idify([self._object.id, inject["case_id"]]),
"case_id": inject["case_id"],
"plan_id": self._object.id,
"sortkey": inject["sortkey"],
}
)
for inject in injects
]
self._object.caseplans._fetch(inset)
开发者ID:thrix,项目名称:python-nitrate,代码行数:32,代码来源:containers.py
示例3: _remove
def _remove(self, plans):
""" Unlink provided plans from the test case """
multicall = xmlrpclib.MultiCall(self._server)
for plan in plans:
log.info("Unlinking {0} from {1}".format(plan.identifier, self._identifier))
multicall.TestCase.unlink_plan(self.id, plan.id)
multicall()
开发者ID:thrix,项目名称:python-nitrate,代码行数:7,代码来源:containers.py
示例4: _add
def _add(self, plans):
""" Set self as parent of given test plans """
log.info("Setting {1} as parent of {0}".format(self._identifier,
listed([plan.identifier for plan in plans])))
for plan in plans:
plan.parent = TestPlan(self.id)
plan.update()
开发者ID:mirekfranc,项目名称:python-nitrate,代码行数:7,代码来源:containers.py
示例5: _remove
def _remove(self, plans):
""" Remove self as parent of given test plans """
log.info("Removing {1} as parent of {0}".format(self._identifier,
listed([plan.identifier for plan in plans])))
for plan in plans:
plan.parent = None
plan.update()
开发者ID:mirekfranc,项目名称:python-nitrate,代码行数:7,代码来源:containers.py
示例6: update
def update(self):
"""
Update all modified mutable objects in the cache
This method uses MultiCall to perform the update which can
significantly speed up things when compared to updating each
individual object separately.
Note: The update is done in batches. The maximum number of objects
updated at once is controlled by the global variable MULTICALL_MAX,
by default set to 10 object per session."""
for klass in self._mutable + self._containers:
modified = [mutable for mutable in klass._cache.itervalues()
if mutable._modified]
if not modified:
continue
log.info("Found {0} in the {1} cache, updating...".format(
listed(modified, "modified object"),
klass.__name__))
for slice in sliced(modified, config.MULTICALL_MAX):
multicall_start()
for mutable in slice:
mutable.update()
multicall_end()
开发者ID:mirekfranc,项目名称:python-nitrate,代码行数:25,代码来源:cache.py
示例7: lock
def lock(self):
""" Create the cache lock unless exists, set mode appropriately """
try:
# Attempt to extract the PID from the lock file
lock = open(self._lock)
pid = lock.readline().strip()
lock.close()
# Make sure the PID is sane (otherwise ignore it)
try:
pid = int(pid)
except ValueError:
log.warn("Malformed cache lock ({0}), ignoring".format(pid))
raise IOError
# Check that the process is still running
if not os.path.exists("/proc/{0}".format(pid)):
log.cache("Breaking stale lock (process {0} dead)".format(pid))
raise IOError
log.info("Found lock {0}, opening read-only".format(self._lock))
self._mode = "read-only"
except IOError:
log.cache("Creating cache lock {0}".format(self._lock))
lock = open(self._lock, "w")
lock.write("{0}\n".format(os.getpid()))
lock.close()
self._mode = "read-write"
开发者ID:mirekfranc,项目名称:python-nitrate,代码行数:25,代码来源:cache.py
示例8: _add
def _add(self, cases):
""" Link provided cases to the test plan """
# Link provided cases on the server
log.info("Linking {1} to {0}".format(self._identifier, listed([case.identifier for case in cases])))
self._server.TestCase.link_plan([case.id for case in cases], self.id)
# Add corresponding CasePlan objects to the PlanCasePlans container
if PlanCasePlans._is_cached(self._object.caseplans):
self._object.caseplans.add([CasePlan(testcase=case, testplan=self._object) for case in cases])
开发者ID:thrix,项目名称:python-nitrate,代码行数:8,代码来源:containers.py
示例9: update
def update(self):
""" Update case plans with modified sortkey """
modified = [caseplan for caseplan in self if caseplan._modified]
# Nothing to do if there are no sortkey changes
if not modified: return
# Update all modified caseplans in a single multicall
log.info("Updating {0}'s case plans".format(self._identifier))
multicall = xmlrpclib.MultiCall(self._server)
for caseplan in modified:
caseplan._update(multicall)
caseplan._modified = False
multicall()
开发者ID:mirekfranc,项目名称:python-nitrate,代码行数:12,代码来源:containers.py
示例10: multicall_end
def multicall_end():
""" Execute xmlrpc call queue and exit MultiCall mode """
log.info("Ending multicall session, sending to the server...")
response = Nitrate._multicall_proxy()
log.data("Server response:")
entries = 0
for entry in response:
log.data(pretty(entry))
entries += 1
Nitrate._multicall_proxy = None
Nitrate._requests += 1
log.info("Multicall session finished, {0} completed".format(
listed(entries, "update")))
return response
开发者ID:mirekfranc,项目名称:python-nitrate,代码行数:14,代码来源:cache.py
示例11: setter
def setter(self, value):
# Initialize the attribute unless already done
if getattr(self, "_" + field) is NitrateNone:
self._fetch()
# Update only if changed
if getattr(self, "_" + field) != value:
setattr(self, "_" + field, value)
log.info(u"Updating {0}'s {1} to '{2}'".format(
self.identifier, field, value))
# Remember modified state if caching
if config.get_cache_level() != config.CACHE_NONE:
self._modified = True
# Save the changes immediately otherwise
else:
self._update()
开发者ID:petr-muller,项目名称:python-nitrate,代码行数:15,代码来源:base.py
示例12: _fetch
def _fetch(self, inject=None):
""" Get the missing test plan type data """
Nitrate._fetch(self, inject)
# Directly fetch from the initial object dict
if inject is not None:
log.info("Processing PlanType ID#{0} inject".format(inject["id"]))
# Search by test plan type id
elif self._id is not NitrateNone:
try:
log.info("Fetching test plan type " + self.identifier)
inject = self._server.TestPlan.get_plan_type(self.id)
except xmlrpclib.Fault as error:
log.debug(error)
raise NitrateError(
"Cannot find test plan type for " + self.identifier)
# Search by test plan type name
else:
try:
log.info(u"Fetching test plan type '{0}'".format(self.name))
inject = self._server.TestPlan.check_plan_type(self.name)
except xmlrpclib.Fault as error:
log.debug(error)
raise NitrateError("PlanType '{0}' not found".format(
self.name))
# Initialize data from the inject and index into cache
log.debug("Initializing PlanType ID#{0}".format(inject["id"]))
log.data(pretty(inject))
self._inject = inject
self._id = inject["id"]
self._name = inject["name"]
self._index(self.name)
开发者ID:mirekfranc,项目名称:python-nitrate,代码行数:32,代码来源:immutable.py
示例13: remove
def remove(self, items):
""" Remove an item or a list of items from the container """
# Convert to set representation
if isinstance(items, list):
items = set(items)
else:
items = set([items])
# If there are any items to be removed
remove_items = items.intersection(self._items)
if remove_items:
log.info("Removing {0} from {1}'s {2}".format(
listed([item.identifier for item in remove_items],
self._class.__name__, max=10),
self._object.identifier,
self.__class__.__name__))
self._items.difference_update(items)
if config.get_cache_level() != config.CACHE_NONE:
self._modified = True
else:
self._update()
开发者ID:mirekfranc,项目名称:python-nitrate,代码行数:22,代码来源:containers.py
注:本文中的nitrate.config.log.info函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论