Exemple #1
0
 def __init__(self, app):
     app.router.add_route(
         "GET",
         "/flows/{flow_id}/runs/{run_number}/steps/{step_name}/"
         "tasks",
         self.get_tasks,
     )
     app.router.add_route(
         "GET",
         "/flows/{flow_id}/runs/{run_number}/steps/{step_name}/"
         "tasks/{task_id}",
         self.get_task,
     )
     app.router.add_route(
         "POST",
         "/flows/{flow_id}/runs/{run_number}/steps/{step_name}/"
         "task",
         self.create_task,
     )
     app.router.add_route(
         "POST",
         "/flows/{flow_id}/runs/{run_number}/steps/{step_name}/tasks/{task_id}/heartbeat",
         self.tasks_heartbeat)
     self._async_table = AsyncPostgresDB.get_instance().task_table_postgres
     self._db = AsyncPostgresDB.get_instance()
Exemple #2
0
 def __init__(self, app):
     app.router.add_route(
         "GET",
         "/flows/{flow_id}/runs/{run_number}/steps/{step_name}/"
         "tasks/{task_id}/artifacts/{artifact_name}",
         self.get_artifact,
     )
     app.router.add_route(
         "GET",
         "/flows/{flow_id}/runs/{run_number}/steps/{step_name}/"
         "tasks/{task_id}/artifacts",
         self.get_artifacts_by_task,
     )
     app.router.add_route(
         "GET",
         "/flows/{flow_id}/runs/{run_number}/steps/{step_name}/"
         "artifacts",
         self.get_artifacts_by_step,
     )
     app.router.add_route(
         "GET",
         "/flows/{flow_id}/runs/{run_number}/artifacts",
         self.get_artifacts_by_run,
     )
     app.router.add_route(
         "POST",
         "/flows/{flow_id}/runs/{run_number}/steps/"
         "{step_name}/tasks/{task_id}/artifact",
         self.create_artifacts,
     )
     self._async_table = AsyncPostgresDB.get_instance(
     ).artifact_table_postgres
     self._db = AsyncPostgresDB.get_instance()
Exemple #3
0
def app(loop=None, db_conf: DBConfiguration = None, middlewares=None):

    loop = loop or asyncio.get_event_loop()
    app = web.Application(loop=loop, middlewares=middlewares)
    async_db = AsyncPostgresDB()
    loop.run_until_complete(async_db._init(db_conf))
    FlowApi(app)
    RunApi(app)
    StepApi(app)
    TaskApi(app)
    MetadataApi(app)
    ArtificatsApi(app)
    AuthApi(app)
    return app
Exemple #4
0
def app(loop=None):

    loop = loop or asyncio.get_event_loop()
    app = web.Application(loop=loop)
    async_db = AsyncPostgresDB()
    loop.run_until_complete(async_db._init())
    FlowApi(app)
    RunApi(app)
    StepApi(app)
    TaskApi(app)
    MetadataApi(app)
    ArtificatsApi(app)
    AuthApi(app)
    setup_swagger(app)
    return app
Exemple #5
0
    def __init__(self, app):
        app.router.add_route(
            "GET", "/flows/{flow_id}/runs/{run_number}/steps", self.get_steps
        )

        app.router.add_route(
            "GET", "/flows/{flow_id}/runs/{run_number}/steps/{step_name}", self.get_step
        )
        app.router.add_route(
            "POST",
            "/flows/{flow_id}/runs/{run_number}/steps/{step_name}/" "step",
            self.create_step,
        )
        self._async_table = AsyncPostgresDB.get_instance().step_table_postgres
        self._run_table = AsyncPostgresDB.get_instance().run_table_postgres
        self._db = AsyncPostgresDB.get_instance()
Exemple #6
0
 def __init__(self, app):
     app.router.add_route("GET", "/flows/{flow_id}/runs", self.get_all_runs)
     app.router.add_route(
         "GET", "/flows/{flow_id}/runs/{run_number}", self.get_run)
     app.router.add_route("POST", "/flows/{flow_id}/run", self.create_run)
     app.router.add_route("POST",
                          "/flows/{flow_id}/runs/{run_number}/heartbeat",
                          self.runs_heartbeat)
     self._async_table = AsyncPostgresDB.get_instance().run_table_postgres
Exemple #7
0
 def __init__(self, app):
     app.router.add_route(
         "GET",
         "/flows/{flow_id}/runs/{run_number}/steps/{step_name}/"
         "tasks/{task_id}/metadata",
         self.get_metadata,
     )
     app.router.add_route(
         "GET",
         "/flows/{flow_id}/runs/{run_number}/metadata",
         self.get_metadata_by_run,
     )
     app.router.add_route(
         "POST",
         "/flows/{flow_id}/runs/{run_number}/steps/{step_name}/"
         "tasks/{task_id}/metadata",
         self.create_metadata,
     )
     self._db = AsyncPostgresDB.get_instance()
     self._async_table = AsyncPostgresDB.get_instance(
     ).metadata_table_postgres
Exemple #8
0
async def init_db(cli):
    db_conf = get_test_dbconf()

    # Make sure migration scripts are applied
    migration_db = MigrationAsyncPostgresDB.get_instance()
    await migration_db._init(db_conf)

    # Apply migrations and make sure "is_up_to_date" == True
    await cli.patch("/migration/upgrade")
    status = await (await cli.get("/migration/db_schema_status")).json()
    assert status["is_up_to_date"] is True

    db = AsyncPostgresDB.get_instance()
    await db._init(db_conf)
    return db
Exemple #9
0
 def __init__(self, app):
     app.router.add_route("GET", "/flows", self.get_all_flows)
     app.router.add_route("GET", "/flows/{flow_id}", self.get_flow)
     app.router.add_route("POST", "/flows/{flow_id}", self.create_flow)
     self._async_table = AsyncPostgresDB.get_instance().flow_table_postgres