Warn if interval is short
This commit is contained in:
parent
c7c4460196
commit
8543446b91
1 changed files with 16 additions and 1 deletions
|
@ -204,8 +204,23 @@ class App:
|
|||
self.config = config
|
||||
self.db = MonitoringDB(self.config.verbose)
|
||||
|
||||
@staticmethod
|
||||
def warnings(config):
|
||||
warn = ""
|
||||
if config.interval < 5:
|
||||
warn += '# Warning: interval<5 is very small and may lead to data gaps.'
|
||||
return warn
|
||||
|
||||
def run_all(self):
|
||||
header = f"# {config.datetime}: {config.cmd}\n#\n"
|
||||
warnings = self.warnings(self.config)
|
||||
if warnings:
|
||||
print(warnings)
|
||||
|
||||
header = f"# {config.datetime}: {config.cmd}\n"
|
||||
if warnings:
|
||||
header += f"{warnings}\n"
|
||||
header += "#\n"
|
||||
|
||||
for jobid in self.config.jobid:
|
||||
try:
|
||||
power = Power.from_db(self.db, jobid, self.config.interval)
|
||||
|
|
Loading…
Reference in a new issue