MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / run

Method run

tools/tasks.py:322–355  ·  view source on GitHub ↗

Run a task with a file descriptor corresponding to its log file

(self, task)

Source from the content-addressed store, hash-verified

320 log("Exit code %d" % result)
321
322 def run(self, task):
323 """Run a task with a file descriptor corresponding to its log file"""
324 command_to_print = getattr(task, "command_to_print", task.command)
325 if task.will_run():
326 log("%s (%s) - " % (task.description, command_to_print), end="")
327 if task.privileged and os.getuid() != 0:
328 log("skipped (needs root privs)")
329 return
330
331 if hasattr(task, "log_file"):
332 filename = task.log_file
333 else:
334 filename = self.default_name
335
336 fp = self.get_file(filename)
337 if not task.no_header:
338 self.header(fp, task.description, command_to_print)
339
340 for i in range(task.num_samples):
341 if i > 0:
342 log(
343 "Taking sample %d after %f seconds - " % (i + 1, task.interval),
344 end="",
345 )
346 time.sleep(task.interval)
347 result = task.execute(fp)
348 self.log_result(result)
349 fp.flush()
350
351 elif self.verbosity >= 2:
352 log(
353 'Skipping "%s" (%s): not for platform %s'
354 % (task.description, command_to_print, sys.platform)
355 )
356
357 def redact_and_zip(self, filename: str, log_type: str, salt: str, node: str):
358 """

Callers 7

test_add_file_taskFunction · 0.95
test_make_curl_taskFunction · 0.95
test_task_print_literalFunction · 0.95
test_task_timeoutFunction · 0.95
test_task_loggingFunction · 0.95
mainFunction · 0.80

Calls 7

get_fileMethod · 0.95
headerMethod · 0.95
log_resultMethod · 0.95
logFunction · 0.85
flushMethod · 0.80
will_runMethod · 0.45
executeMethod · 0.45

Tested by 6

test_add_file_taskFunction · 0.76
test_make_curl_taskFunction · 0.76
test_task_print_literalFunction · 0.76
test_task_timeoutFunction · 0.76
test_task_loggingFunction · 0.76