Esempio n. 1
0
    def longhelp(cls):
        """Create a long help text with full docstrings for each subclass of WorkflowStage

        Subclasses are found using cliutils.all_subclasses
        """
        helpstrings = []

        helpstrings.append("The following WorkflowStages are available:\n")

        for sub in all_subclasses(cls):
            helpstrings.append("{0}: {1}\n    {2}\n".format(sub.spec, sub.__name__, sub.__doc__))

        return "".join(helpstrings)
Esempio n. 2
0
    def longhelp(cls):
        """Create a long help text with full docstrings for each subclass of WorkflowStage

        Subclasses are found using cliutils.all_subclasses
        """
        helpstrings = []

        helpstrings.append('The following WorkflowStages are available:\n')

        for sub in all_subclasses(cls):
            helpstrings.append('{0}: {1}\n    {2}\n'.format(
                sub.spec, sub.__name__, sub.__doc__))

        return ''.join(helpstrings)
Esempio n. 3
0
def main():
    """This method is installed as a console script entry point by setuptools

    It uses the command line arguments specified by opts() to generate a
    Workflow object and adds to it several WorkflowStages.

    If the needed command line arguments are not passed, the user is asked to
    enter them.

    The generated Workflow object is then executed with run() 
    """

    args = opts().parse_args()

    if args.help == 'all':
        opts().print_help()
        return
    elif args.help == 'stages':
        print WorkflowStage.longhelp()
        return

    logging.basicConfig(
        level=getattr(logging, args.logging.upper()),
        format='%(levelname)s: %(asctime)s in %(name)s - %(message)s',
        datefmt='%m/%d/%Y %I:%M:%S %p'
    )

    w = Workflow()

    if not args.stages:
        print 'Stages not given with --stages argument'
        print WorkflowStage.shorthelp()
        stages = raw_input(
            'Enter space separated stage specifiers (e.g. "1 2 3"): ').split()
    else:
        stages = args.stages

    classmap = {cls.spec: cls for cls in all_subclasses(WorkflowStage)}

    for stage_spec in stages:
        try:
            w.append(classmap[stage_spec](args))
        except KeyError as e:
            logging.error(
                'No valid stage specifier {0} - use "--help stages" to see '
                'stage specifiers for this software'.format(stage_spec))
            raise

    w.run()
Esempio n. 4
0
    def shorthelp(cls):
        """Create a short help text with one line for each subclass of WorkflowStage

        Subclasses are found using cliutils.all_subclasses
        """

        helpstrings = []

        helpstrings.append("The following WorkflowStages are available:\n")

        for sub in all_subclasses(cls):
            helpstrings.append("{0}: {1} - {2}\n".format(sub.spec, sub.__name__, firstline(sub.__doc__)))

        helpstrings.append('Use "--help stages" for more details\n')
        return "".join(helpstrings)
Esempio n. 5
0
    def shorthelp(cls):
        """Create a short help text with one line for each subclass of WorkflowStage

        Subclasses are found using cliutils.all_subclasses
        """

        helpstrings = []

        helpstrings.append('The following WorkflowStages are available:\n')

        for sub in all_subclasses(cls):
            helpstrings.append('{0}: {1} - {2}\n'.format(
                sub.spec, sub.__name__, firstline(sub.__doc__)))

        helpstrings.append('Use "--help stages" for more details\n')
        return ''.join(helpstrings)