Example #1
0
 def construct_parser(self):
     usage = "%s <trial_number> [arguments]" % self.command
     parser = arguments.get_parser(prog=self.command, usage=usage, description=self.summary)
     parser.add_argument('number', 
                         help="Number of the trial to delete",
                         metavar='<trial_number>')
     return parser
Example #2
0
 def construct_parser(self):
     usage = "%s [arguments] <subcommand> [options]"  % self.command
     epilog = ["", cli.commands_description(), "",
               "shortcuts:",
               "  %(command)s <compiler>  Execute a compiler command", 
               "                  - Example: %(command)s gcc *.c -o a.out",
               "                  - Alias for '%(command)s build <compiler>'",
               "  %(command)s <program>   Gather data from a program",
               "                  - Example: %(command)s ./a.out",
               "                  - Alias for '%(command)s trial create <program>'",
               "  %(command)s show        Show data from the most recent trial",
               "                  - An alias for '%(command)s trial show'",
               "",
               "See '%(command)s help <subcommand>' for more information on <subcommand>."]
     parser = arguments.get_parser(prog=self.command,
                                   usage=usage,
                                   description=self.summary,
                                   epilog='\n'.join(epilog) % {'command': self.command})
     parser.add_argument('command',
                         help="See subcommand descriptions below",
                         metavar='<subcommand>')
     parser.add_argument('options',
                         help="Options to be passed to <subcommand>",
                         metavar='[options]',
                         nargs=arguments.REMAINDER)
     parser.add_argument('-v', '--verbose',
                         help="Set stdout logging level to DEBUG",
                         metavar='',
                         const='DEBUG',
                         default='INFO',
                         action='store_const')
     return parser
Example #3
0
 def construct_parser(self):
     key_str = self.model_name + '_' + self.model.key_attribute
     usage_head = ("%(command)s [%(key_str)s] [%(key_str)s] ... [arguments]" % 
                   {'command': self.command, 'key_str': key_str})
     parser = arguments.get_parser(prog=self.command,
                                   usage=usage_head,
                                   description=self.summary)
     parser.add_argument('keys', 
                         help=("Show only %(model_name)ss with the given %(key_attr)ss" % self._format_fields),
                         metavar=key_str,
                         nargs='*',
                         default=arguments.SUPPRESS)
     style_dest = 'style'
     style_group = parser.add_mutually_exclusive_group()
     style_group.add_argument('-s', '--short', 
                              help="show minimal %(model_name)s data" % self._format_fields,
                              const='short', action='store_const', dest=style_dest, 
                              default=arguments.SUPPRESS)
     style_group.add_argument('-d', '--dashboard', 
                              help="show %(model_name)s data in a fancy dasboard" % self._format_fields,
                              const='dashboard', action='store_const', dest=style_dest, 
                              default=arguments.SUPPRESS)
     style_group.add_argument('-l', '--long', 
                              help="show all %(model_name)s data in a list" % self._format_fields,
                              const='long', action='store_const', dest=style_dest, 
                              default=arguments.SUPPRESS)
     style_group.add_argument('-j', '--json', 
                              help="show all %(model_name)s data as JSON" % self._format_fields,
                              const='json', action='store_const', dest=style_dest, 
                              default=arguments.SUPPRESS)
     arguments.add_storage_flags(parser, "show", self.model_name, plural=True, exclusive=False)
     return parser
Example #4
0
 def construct_parser(self):
     usage_head = "%s <command>|<file> [arguments]" % self.command
     parser = arguments.get_parser(prog=self.command, usage=usage_head, description=self.summary)
     parser.add_argument('command', 
                         help="A TAU command, system command, or file",
                         metavar='(<command>|<file>)',
                         nargs='+')
     return parser
Example #5
0
 def construct_parser(self):
     key_attr = self.model.key_attribute
     usage = "%s <%s_%s> [arguments]" % (self.command, self.model_name, key_attr)       
     epilog = "WARNING: This cannot be undone."
     parser = arguments.get_parser(prog=self.command,
                                   usage=usage,
                                   description=self.summary,
                                   epilog=epilog)
     parser.add_argument(key_attr,
                         help="%s of %s configuration to delete" % (key_attr.capitalize(), self.model_name),
                         metavar='<%s_%s>' % (self.model_name, key_attr))
     arguments.add_storage_flags(parser, "delete", self.model_name)
     return parser
Example #6
0
 def construct_parser(self):
     usage = "%s [trial_number] [trial_number] ... [arguments]" % self.command
     parser = arguments.get_parser(prog=self.command, usage=usage, description=self.summary)
     parser.add_argument('--tool', 
                         help="specify reporting or visualization tool",
                         metavar='tool_name',
                         default=arguments.SUPPRESS)
     parser.add_argument('numbers', 
                         help="show details for specified trials",
                         metavar='trial_number',
                         nargs='*',
                         default=arguments.SUPPRESS)
     return parser
Example #7
0
    def construct_parser(self):
        usage = "%s [arguments]" % self.command
        parser = arguments.get_parser(prog=self.command, usage=usage, description=self.summary)
        
        default_project_name = os.path.basename(os.getcwd()) or 'default_project'
        project_group = parser.add_argument_group('project arguments')
        project_group.add_argument('--project-name',
                                   help="Name of the new project",
                                   metavar='<name>',
                                   default=default_project_name)
        
        parser.merge(target_create_cmd.parser, group_title='target arguments', include_positional=False)
        default_target_name = platform.node() or 'default_target'
        target_group = parser.add_argument_group('target arguments')
        target_group.add_argument('--target-name',
                                  help="Name of the new target configuration",
                                  metavar='<name>',
                                  default=default_target_name)

        parser.merge(application_create_cmd.parser, group_title='application arguments', include_positional=False)
        default_application_name = os.path.basename(os.getcwd()) or 'default_application'
        application_group = parser.add_argument_group('application arguments')
        application_group.add_argument('--application-name',
                                       help="Name of the new application configuration",
                                       metavar='<name>',
                                       default=default_application_name)

        measurement_group = parser.add_argument_group('measurement arguments')
        measurement_group.add_argument('--profile',
                                       help="Create measurement configurations for profiling",
                                       metavar='T/F',
                                       nargs='?',
                                       const=True,
                                       default=True,
                                       action=ParseBooleanAction)
        measurement_group.add_argument('--trace',
                                       help="Create measurement configurations for tracing",
                                       metavar='T/F',
                                       nargs='?',
                                       const=True,
                                       default=True,
                                       action=ParseBooleanAction)
        measurement_group.add_argument('--sample',
                                       help="Create measurement configurations for event-based sampling",
                                       metavar='T/F',
                                       nargs='?',
                                       const=True,
                                       default=True,
                                       action=ParseBooleanAction)
        return parser
Example #8
0
 def construct_parser(self):
     usage = "%s <subcommand> [arguments]" % self.command
     epilog = ['', cli.commands_description(self.module_name), '',
               "See '%s <subcommand> --help' for more information on <subcommand>." % self.command]
     parser = arguments.get_parser(prog=self.command, usage=usage, 
                                   description=self.summary, epilog='\n'.join(epilog))
     parser.add_argument('subcommand', 
                         help="See 'subcommands' below",
                         metavar='<subcommand>')
     parser.add_argument('options', 
                         help="Arguments to be passed to <subcommand>",
                         metavar='[arguments]',
                         nargs=arguments.REMAINDER)
     return parser
Example #9
0
 def construct_parser(self):
     family_containers = CompilerFamily, MpiCompilerFamily
     known_compilers = [comp for container in family_containers for family in container.all() for comp in family]
     parts = ['  %s  %s' % ('{:<15}'.format(comp.command), comp.short_descr) for comp in known_compilers]
     compilers_help = '\n'.join(parts)
     epilog = "known compiler commands:\n%s\n" % compilers_help
     usage = "%s <command> [arguments]" % self.command
     parser = arguments.get_parser(prog=self.command, usage=usage, description=self.summary, epilog=epilog)
     parser.add_argument('cmd',
                         help="Compiler or linker command, e.g. 'gcc'",
                         metavar='<command>')
     parser.add_argument('cmd_args', 
                         help="Compiler arguments",
                         metavar='[arguments]',
                         nargs=arguments.REMAINDER)
     return parser
Example #10
0
 def construct_parser(self):
     usage = "%s [arguments] [--] <command> [command_arguments]" % self.command
     parser = arguments.get_parser(prog=self.command, usage=usage, description=self.summary)
     parser.add_argument('cmd',
                         help="Executable command, e.g. './a.out'",
                         metavar='<command>')
     parser.add_argument('cmd_args', 
                         help="Executable command arguments",
                         metavar='[command_arguments]',
                         nargs=arguments.REMAINDER)
     parser.add_argument('--launcher',
                         help="Launcher command with arguments, e.g. 'mpirun -np 4'",
                         metavar='<command>',
                         nargs=arguments.REMAINDER,
                         default=arguments.SUPPRESS)
     return parser
Example #11
0
 def construct_parser(self):
     usage = "%s [project] [target] [application] [measurement] [arguments]" % self.command
     parser = arguments.get_parser(prog=self.command, usage=usage, description=self.summary)
     parser.add_argument('impl_project',
                         help="Project configuration name",
                         metavar='[project]',
                         nargs='*',
                         default=arguments.SUPPRESS)
     parser.add_argument('impl_target',
                         help="Target configuration name",
                         metavar='[target]',
                         nargs='*',
                         default=arguments.SUPPRESS)
     parser.add_argument('impl_application',
                         help="Application configuration name",
                         metavar='[application]',
                         nargs='*',
                         default=arguments.SUPPRESS)
     parser.add_argument('impl_measurement',
                         help="Measurement configuration name",
                         metavar='[measurement]',
                         nargs='*',
                         default=arguments.SUPPRESS)
     parser.add_argument('--project',
                         help="Project configuration name",
                         metavar='<name>',
                         default=arguments.SUPPRESS)
     parser.add_argument('--target',
                         help="Target configuration name",
                         metavar='<name>',
                         default=arguments.SUPPRESS)
     parser.add_argument('--application',
                         help="Application configuration name",
                         metavar='<name>',
                         default=arguments.SUPPRESS)
     parser.add_argument('--measurement',
                         help="Measurement configuration name",
                         metavar='<name>',
                         default=arguments.SUPPRESS)
     return parser
Example #12
0
 def construct_parser(self):
     usage = "%s [arguments]" % self.command
     return arguments.get_parser(prog=self.command, usage=usage, description=self.summary)
Example #13
0
 def construct_parser(self):
     usage = self.command
     parser = arguments.get_parser(prog=self.command, usage=usage, description=self.summary)
     return parser