Control workflow metrics collection.
(self, line)
| 816 | pass |
| 817 | |
| 818 | def do_metrics(self, line): |
| 819 | """Control workflow metrics collection.""" |
| 820 | parser = argparse.ArgumentParser(exit_on_error=False) |
| 821 | parser.add_argument("--enable", action="store_true", default=None, help="Enable logging") |
| 822 | parser.add_argument("--disable", action="store_true", default=False, help="Disable logging") |
| 823 | parser.add_argument("--global", action="store_true", default=False, dest="is_global", help="Enable or disable logging globally") |
| 824 | try: |
| 825 | args = parser.parse_args(line.split()) |
| 826 | if args.enable is None: |
| 827 | enable = not args.disable |
| 828 | else: |
| 829 | enable = args.enable |
| 830 | status = self.machine.metrics(enable=enable, is_global=args.is_global) |
| 831 | print(json.dumps(status, indent=4)) |
| 832 | except argparse.ArgumentError as e: |
| 833 | print("ArgumentError:", e) |
| 834 | except SystemExit: |
| 835 | pass |
| 836 | |
| 837 | def do_dump(self, line): |
| 838 | """Dump metrics from the workflow system.""" |