Exemple #1
0
 def test_FuncNoArgs(self):
     def func():
         for i in xrange(1000):
             pass
         
     t = Task()
     t.func = func
     t.run()
Exemple #2
0
    def test_FuncNoArgs(self):
        def func():
            for i in xrange(1000):
                pass

        t = Task()
        t.func = func
        t.run()
Exemple #3
0
 def test_FuncArgs(self):
     def func(some_arg=0):
         for i in xrange(some_arg):
             pass
     
     t = Task()
     t.func = func
     t.args_in = {'some_arg': 1000}
     t.run()
Exemple #4
0
 async def put_task(self, request):
     data = await request.json()
     try:
         task = Task(**data)
     except TaskValidationError as ex:
         return web.json_response({
             'status': 400,
             'message': str(ex)
         },
                                  status=400)
     self.app['queue'].put_task(task)
     return web.json_response({'status': 200, 'message': 'OK'})
Exemple #5
0
    def test_FuncArgs(self):
        def func(some_arg=0):
            for i in xrange(some_arg):
                pass

        t = Task()
        t.func = func
        t.args_in = {'some_arg': 1000}
        t.run()
Exemple #6
0
 def test_initTask(self):
     t = Task()
Exemple #7
0
"""
DO NOT MODIFY THIS FILE.
"""

import os
import dotenv
from app.task import Task
from podder_task_foundation import MODE, Context
from podder_task_foundation.api import GrpcServer, TaskApiExecutor
from podder_task_foundation.api.protos import pipeline_framework_pb2_grpc

DEFAULT_GRPC_PID_FILE = "/var/run/poc_base.pid"
DEFAULT_PORT = 50051
DEFAULT_MAX_WORKERS = 10

if __name__ == '__main__':
    """
    Run gRPC server.
    """
    task = Task(MODE.PIPELINE)
    dotenv.load_dotenv(".env")
    GrpcServer(
        stdout_file=open(os.getenv("GRPC_LOG"), 'a'),
        stderr_file=open(os.getenv("GRPC_ERROR_LOG"), 'a'),
        pidfile_path=os.getenv("GRPC_PID_FILE", DEFAULT_GRPC_PID_FILE),
        max_workers=os.getenv("GRPC_MAX_WORKERS", DEFAULT_MAX_WORKERS),
        port=os.getenv("GRPC_PORT", DEFAULT_PORT),
        execution_task=Task,
        add_servicer_method=pipeline_framework_pb2_grpc.add_PodderTaskApiServicer_to_server).run()
def main() -> None:
    task = Task(MODE.CONSOLE)
    job_id = str(uuid.uuid1())
    task.handle(job_id, DAG_ID)