本文整理汇总了Python中datalogger.DataLogger.get_last_business_day_datestring方法的典型用法代码示例。如果您正苦于以下问题:Python DataLogger.get_last_business_day_datestring方法的具体用法?Python DataLogger.get_last_business_day_datestring怎么用?Python DataLogger.get_last_business_day_datestring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datalogger.DataLogger
的用法示例。
在下文中一共展示了DataLogger.get_last_business_day_datestring方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_statics
# 需要导入模块: from datalogger import DataLogger [as 别名]
# 或者: from datalogger.DataLogger import get_last_business_day_datestring [as 别名]
def test_statics(self):
self.assertTrue(isinstance(DataLogger.get_user(self.basedir), basestring))
self.assertTrue(isinstance(DataLogger.get_group(self.basedir), basestring))
self.assertTrue(isinstance(DataLogger.get_yesterday_datestring(), basestring))
lbd = DataLogger.get_last_business_day_datestring()
self.assertTrue(isinstance(DataLogger.get_last_business_day_datestring(), basestring))
self.assertTrue(isinstance(DataLogger.datestring_to_date(lbd), datetime.date))
for datestring in DataLogger.datewalker("2016-01-01", "2016-02-29"):
self.assertTrue(isinstance(datestring, basestring))
for datestring in DataLogger.monthwalker("2016-02"):
self.assertTrue(isinstance(datestring, basestring))
self.assertEqual(list(DataLogger.monthwalker("2016-02"))[-1], "2016-02-29")
self.assertTrue(isinstance(DataLogger.get_ts_for_datestring("2016-01-01"), tuple))
self.assertTrue(isinstance(DataLogger.get_ts_for_datestring("2016-01-01")[0], float))
self.assertTrue(isinstance(DataLogger.get_ts_for_datestring("2016-01-01")[1], float))
示例2: get_last_business_day_datestring
# 需要导入模块: from datalogger import DataLogger [as 别名]
# 或者: from datalogger.DataLogger import get_last_business_day_datestring [as 别名]
def get_last_business_day_datestring(args):
"""
get datestring of last businessday Mo.-Fr.
ex: Dataloger/get_last_business_day_datestring/...
returns:
json(datestring of last businessday)
"""
return json.dumps(DataLogger.get_last_business_day_datestring())
示例3: get_projects
# 需要导入模块: from datalogger import DataLogger [as 别名]
# 或者: from datalogger.DataLogger import get_last_business_day_datestring [as 别名]
def get_projects():
"""
get available projects for this Datalogger Server
ex: Datalogger/get_projects/...
there is no further argument needed
returns:
json(existing project names)
"""
ret_data = {
"projects" : DataLogger.get_projects(basedir),
"stat_func_names" : TimeseriesStats.stat_funcs.keys(),
"last_businessday_datestring" : DataLogger.get_last_business_day_datestring()
}
return json.dumps(ret_data)
示例4: main
# 需要导入模块: from datalogger import DataLogger [as 别名]
# 或者: from datalogger.DataLogger import get_last_business_day_datestring [as 别名]
logging.basicConfig(level=logging.INFO)
from datalogger import DataLogger as DataLogger
from datalogger import TimeseriesArray as TimeseriesArray
from datalogger import TimeseriesArrayStats as TimeseriesArrayStats
from datalogger import Timeseries as Timeseries
def main():
tsastat = datalogger.load_tsastats("2016-02-08")
data = []
data.append(("hostname", "hrStorageSizeKb", "hrStorageUsedKb", "hrStorageNotUsedKbMin"))
for index_key in tsastat.keys():
# (u'srvcacdbp1.tilak.cc', u'Physical Memory',
# u'HOST-RESOURCES-TYPES::hrStorageRam')
if u'HOST-RESOURCES-TYPES::hrStorageRam' not in index_key:
del tsastat[index_key]
for key, tsstat in datalogger.tsastat_group_by(tsastat, ("hostname", )).items():
sizekb = tsstat["hrStorageSize"]["min"] * tsstat["hrStorageAllocationUnits"]["max"] / 1024
usedkb = tsstat["hrStorageUsed"]["max"] * tsstat["hrStorageAllocationUnits"]["max"] / 1024
notused = sizekb - usedkb
data.append((key[0], "%0.2f" % sizekb, "%0.2f" % usedkb, "%0.2f" % notused))
for row in data:
print("\t".join(row))
if __name__ == "__main__":
project = "snmp"
tablename = "hrStorageTable"
datalogger = DataLogger("/var/rrd", project, tablename)
datestring = DataLogger.get_last_business_day_datestring()
#main()
cProfile.run("main()")