예제 #1
0
def cli(ctx, workflow_id, **kwds):
    """
    Get a list of invocations for a particular workflow ID or alias.
    """
    workflow_id = translate_alias(ctx, workflow_id, kwds.get('profile'))
    info("Looking for invocations for workflow {}...".format(workflow_id))
    workflow_id = profiles.translate_alias(ctx, workflow_id,
                                           kwds.get('profile'))
    profile = profiles.ensure_profile(ctx, kwds.get('profile'))

    invocations = get_invocations(url=profile['galaxy_url'],
                                  key=profile['galaxy_admin_key']
                                  or profile['galaxy_user_key'],
                                  workflow_id=workflow_id)
    if tabulate:
        state_colors = {
            'ok': '\033[92m',  # green
            'running': '\033[93m',  # yellow
            'error': '\033[91m',  # red
            'paused': '\033[96m',  # cyan
            'deleted': '\033[95m',  # magenta
            'deleted_new': '\033[95m',  # magenta
            'new': '\033[96m',  # cyan
            'queued': '\033[93m',  # yellow
        }
        print(
            tabulate(
                {
                    "Invocation ID":
                    invocations.keys(),
                    "Jobs status": [
                        ', '.join([
                            '{}{} jobs {}\033[0m'.format(
                                state_colors[k], v, k)
                            for k, v in inv['states'].items()
                        ]) for inv in invocations.values()
                    ],
                    "Invocation report URL": [
                        '{}/workflows/invocations/report?id={}'.format(
                            profile['galaxy_url'].strip('/'), inv_id)
                        for inv_id in invocations
                    ],
                    "History URL": [
                        '{}/histories/view?id={}'.format(
                            profile['galaxy_url'].strip('/'),
                            invocations[inv_id]['history_id'])
                        for inv_id in invocations
                    ]
                },
                headers="keys"))
    else:
        error(
            "The tabulate package is not installed, invocations could not be listed correctly."
        )
        print(json.dumps(invocations, indent=4, sort_keys=True))
    info("{} invocations found.".format(len(invocations)))

    return
예제 #2
0
파일: cli.py 프로젝트: AjitPS/planemo
 def handle_profile_options(*args, **kwds):
     profile = kwds.get("profile", None)
     if profile:
         ctx = args[0]
         profile_defaults = profiles.ensure_profile(ctx, profile, **kwds)
         for key, value in profile_defaults.items():
             if ctx.get_option_source(key) != OptionSource.cli:
                 kwds[key] = value
                 ctx.set_option_source(key, OptionSource.profile, force=True)
     return f(*args, **kwds)
예제 #3
0
    def handle_profile_options(*args, **kwds):
        profile = kwds.get("profile", None)
        if profile:
            ctx = args[0]
            profile_defaults = profiles.ensure_profile(ctx, profile, **kwds)
            _setup_profile_options(ctx, profile_defaults, kwds)

        try:
            return f(*args, **kwds)
        except ExitCodeException as e:
            sys.exit(e.exit_code)
예제 #4
0
파일: cli.py 프로젝트: lecorguille/planemo
 def handle_profile_options(*args, **kwds):
     profile = kwds.get("profile", None)
     if profile:
         ctx = args[0]
         profile_defaults = profiles.ensure_profile(ctx, profile, **kwds)
         for key, value in profile_defaults.items():
             if ctx.get_option_source(key) != OptionSource.cli:
                 kwds[key] = value
                 ctx.set_option_source(key,
                                       OptionSource.profile,
                                       force=True)
     return f(*args, **kwds)
예제 #5
0
    def handle_profile_options(*args, **kwds):
        profile = kwds.get("profile", None)
        if profile:
            ctx = args[0]
            profile_defaults = profiles.ensure_profile(
                ctx, profile, **kwds
            )
            _setup_profile_options(ctx, profile_defaults, kwds)

        try:
            return f(*args, **kwds)
        except ExitCodeException as e:
            sys.exit(e.exit_code)