Ejemplo n.º 1
0
 def wes_get_service_info(self):
     logging.debug(f"Call wes_get_service_info")
     response = {
         "workflow_type_versions": {
             "CWL": {"workflow_type_version": ["v1.0"]}
         },
         "supported_wes_versions": ["1.0.0"],
         "supported_filesystem_protocols": ["file"],
         "workflow_engine_versions": {
             "cwl-airflow": get_version()
         }
     }
     return response
Ejemplo n.º 2
0
def get_parser():
    """
    Defines arguments for parser. Inlcudes two subparsers for
    api server and init components.
    """

    parent_parser = argparse.ArgumentParser(add_help=False)
    general_parser = argparse.ArgumentParser(
        description="CWL-Airflow: a lightweight pipeline manager \
            supporting Common Workflow Language")
    subparsers = general_parser.add_subparsers()
    subparsers.required = True

    general_parser.add_argument("--version",
                                action="version",
                                version=get_version(),
                                help="Print current version and exit")

    # API
    api_parser = subparsers.add_parser("api",
                                       parents=[parent_parser],
                                       help="Run API server")
    api_parser.set_defaults(func=run_api_server)
    api_parser.add_argument(
        "--port",
        type=int,
        default=8081,
        help="Set port to run API server. Default: 8081",
    )
    api_parser.add_argument(
        "--host",
        type=str,
        default="127.0.0.1",
        help="Set host to run API server. Default: 127.0.0.1")
    api_parser.add_argument(
        "--simulation",
        type=str,
        nargs="?",  #  0 or 1 argument
        const=path.abspath(
            path.join(__file__, "../../data/default_simulation_suite.yaml")),
        help="Set path to the test suite file to simulate reports. \
            Pipelines won't get triggered in this mode. \
            Default: real reports from the star-index workflow")
    api_parser.add_argument(
        "--replay",
        type=int,
        help="Retries to post undelivered progress and results reports \
            to the process_report connection every N seconds. \
            If connection is not set this parameter is ignored. \
            Default: do not resend not delivered reports")

    # Init
    init_parser = subparsers.add_parser("init",
                                        parents=[parent_parser],
                                        help="Run initial configuration")
    init_parser.set_defaults(func=run_init_config)
    init_parser.add_argument("--home",
                             type=str,
                             default=get_airflow_home(),
                             help="Set path to Airflow home directory. \
            Default: first try AIRFLOW_HOME then '~/airflow'")
    init_parser.add_argument("--config",
                             type=str,
                             help="Set path to Airflow configuration file. \
            Default: first try AIRFLOW_CONFIG then '[airflow home]/airflow.cfg'"
                             )
    init_parser.add_argument(
        "--upgrade",
        action="store_true",
        help="Upgrade old CWLDAG files to the latest format. \
            Default: False")

    # Test (for running conformance tests)
    test_parser = subparsers.add_parser("test",
                                        parents=[parent_parser],
                                        help="Run conformance tests")
    test_parser.set_defaults(func=run_test_conformance)
    test_parser.add_argument("--suite",
                             type=str,
                             required=True,
                             help="Set path to the conformance test suite")
    test_parser.add_argument("--tmp",
                             type=str,
                             default=mkdtemp(),
                             help="Set path to the temp folder. Default: /tmp")
    test_parser.add_argument(
        "--host",
        type=str,
        default="127.0.0.1",
        help="Set host to listen for DAG results and status updates. \
            Default: 127.0.0.1")
    test_parser.add_argument(
        "--port",
        type=int,
        default=3070,
        help="Set port to listen for DAG results and status updates. \
            Should correspond to the port from 'process_report' connection. \
            Default: 3070")
    test_parser.add_argument(
        "--api",
        type=str,
        default="http://127.0.0.1:8081",
        help="Set CWL-Airflow API's base url (IP address and port). \
            Default: http://127.0.0.1:8081")
    test_parser.add_argument("--range",
                             type=str,
                             help="Set test range to run, format 1,3-6,9. \
            Order corresponds to the tests from --suite file, starting from 1. \
            Default: run all tests")
    test_parser.add_argument(
        "--spin",
        action="store_true",
        help="Display spinner wher running. Useful for CI that tracks activity. \
            Default: do not spin")
    test_parser.add_argument(
        "--embed",
        action="store_true",
        help=
        "Embed base64 encoded gzip compressed workflow content into the DAG python file. \
            Default: False")
    test_parser.add_argument(
        "--combine",
        action="store_true",
        help="Create and trigger DAG using a single API call. \
            Default: False")
    test_parser.add_argument(
        "--relative",
        action="store_true",
        help="Skip relative paths resolution before submitting jobs to API. \
            Default: False")
    return general_parser
Ejemplo n.º 3
0
def get_parser():
    """
    Defines arguments for parser. Inlcudes two subparsers for
    api server and init components.
    """

    parent_parser = argparse.ArgumentParser(add_help=False)
    general_parser = argparse.ArgumentParser(
        description="CWL-Airflow: a lightweight pipeline manager \
            supporting Common Workflow Language")
    subparsers = general_parser.add_subparsers()
    subparsers.required = True

    general_parser.add_argument("--version",
                                action="version",
                                version=get_version(),
                                help="Print current version and exit")

    # API
    api_parser = subparsers.add_parser("api",
                                       parents=[parent_parser],
                                       help="Run API server")
    api_parser.set_defaults(func=run_api_server)
    api_parser.add_argument(
        "--port",
        type=int,
        default=8081,
        help="Set port to run API server. Default: 8081",
    )
    api_parser.add_argument(
        "--host",
        type=str,
        default="127.0.0.1",
        help="Set host to run API server. Default: 127.0.0.1")

    # Init
    init_parser = subparsers.add_parser("init",
                                        parents=[parent_parser],
                                        help="Run initial configuration")
    init_parser.set_defaults(func=run_init_config)
    init_parser.add_argument("--home",
                             type=str,
                             default=get_airflow_home(),
                             help="Set path to Airflow home directory. \
            Default: first try AIRFLOW_HOME then '~/airflow'")
    init_parser.add_argument("--config",
                             type=str,
                             help="Set path to Airflow configuration file. \
            Default: first try AIRFLOW_CONFIG then '[airflow home]/airflow.cfg'"
                             )
    init_parser.add_argument(
        "--upgrade",
        action="store_true",
        help="Upgrade old CWLDAG files to the latest format. \
            Default: False")

    # Test (for running conformance tests)
    test_parser = subparsers.add_parser("test",
                                        parents=[parent_parser],
                                        help="Run conformance tests")
    test_parser.set_defaults(func=run_test_conformance)
    test_parser.add_argument("--suite",
                             type=str,
                             required=True,
                             help="Set path to the conformance test suite")
    test_parser.add_argument("--tmp",
                             type=str,
                             default=mkdtemp(),
                             help="Set path to the temp folder. Default: /tmp")
    test_parser.add_argument(
        "--port",
        type=int,
        default=3070,
        help="Set port to listen for DAG results and status updates. \
            Should correspond to the port from 'process_report' connection. \
            Default: 3070")
    test_parser.add_argument(
        "--api",
        type=str,
        default="http://127.0.0.1:8081",
        help="Set CWL-Airflow API's base url (IP address and port). \
            Default: http://127.0.0.1:8081")
    test_parser.add_argument("--range",
                             type=str,
                             help="Set test range to run, format 1,3-6,9. \
            Order corresponds to the tests from --suite file, starting from 1. \
            Default: run all tests")
    test_parser.add_argument(
        "--spin",
        action="store_true",
        help="Display spinner wher running. Useful for CI that tracks activity. \
            Default: do not spin")
    test_parser.add_argument(
        "--embed",
        action="store_true",
        help=
        "Embed base64 encoded zlib compressed workflow content into the DAG python file. \
            Default: False")

    return general_parser