Beispiel #1
0
 def __init__(self, first_name, last_name, profession, deegre,
              work_experience, created_documental_films, wish_salary,
              Clothes, Style):
     Worker.__init__(self, first_name, last_name, profession, deegre,
                     work_experience, created_documental_films, wish_salary)
     self.Clothes = Clothes
     self.Style = Style
Beispiel #2
0
 def __init__(self, first_name, last_name, profession, deegre,
              work_experience, created_documental_films, wish_salary,
              making_landscape, making_room):
     Worker.__init__(self, first_name, last_name, profession, deegre,
                     work_experience, created_documental_films, wish_salary)
     self.making_landscape = making_landscape
     self.making_room = making_room
Beispiel #3
0
 def __init__(self, first_name, last_name, profession, deegre,
              work_experience, created_documental_films, wish_salary,
              Scenario):
     Worker.__init__(self, first_name, last_name, profession, deegre,
              work_experience, created_documental_films, wish_salary)
     self.Scenario = Scenario
#!/usr/bin/python
from components.HiveResponseProcessor import HiveResponseProcessor
from services.WorkerService import WorkerService
from models.Worker import Worker
import os, inspect, re

task = 1
_file = '/../TestHiveResponse'

thisPath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) # script directory
resultPath = os.path.abspath(thisPath + '/../result/')

worker = Worker()
worker.workerId = task
workerService = WorkerService(resultPath, worker)
task = workerService.getTask()

r = re.compile('\s+')

f = open(os.path.abspath(thisPath + _file), 'r')
data = f.readlines()
data = [r.split(line) for line in data]

processor = HiveResponseProcessor(task)
processor.prepareData(data)
Beispiel #5
0
 def __init__(self, first_name, last_name, profession, deegre,
              work_experience, created_documental_films, wish_salary,
              own_camera):
     Worker.__init__(self, first_name, last_name, profession, deegre,
                     work_experience, created_documental_films, wish_salary)
     self.own_camera = own_camera
    def post(self, *args, **kwargs):
        app = self.checkAppAccess(args)

        saveAsTemplate = str(self.get_argument("saveAsTemplate", default=""))

        # создаем задачу из аргументов
        task = createTaskFromRequestArguments(self.request.arguments)
        session = self.getDBSession()

        if saveAsTemplate:
            # сохраняем шаблон
            taskTemplate = TaskTemplate()
            taskTemplate.appId = app.appId
            taskTemplate.name = self.get_argument("taskName", default=None)
            taskTemplate.userId = self.get_current_user().userId
            taskTemplate.shared = TaskTemplate.SHARED_NO

            session.add(taskTemplate)
            session.commit()

            # скидываем на диск
            taskTemplateFile = TaskTemplateFile(
                self.application.getTemplatePath(), task=task, taskTemplate=taskTemplate
            )
            taskTemplateFile.baseDate = datetime.now()
            taskTemplateFile.save()

            self.redirect("/dashboard/app/{}/#templates".format(app.code))
            return

        user = self.get_current_user()

        # объект для записи в базу
        worker = Worker()
        worker.userId = user.userId
        worker.startDate = datetime.now()
        worker.status = Worker.STATUS_ALIVE
        worker.appId = app.appId
        worker.name = self.get_argument("taskName", default=None)

        # генерируем имя запроса
        appService = AppService(self.application.getAppConfigPath())
        appConfig = appService.getAppConfig(app.code)
        nameConstructor = NameConstructor(appConfig, task)
        if not worker.name:
            worker.name = nameConstructor.generateTaskName()

        session.add(worker)
        session.commit()

        # конструирем запрос
        constructor = HiveQueryConstructor(task, appConfig)
        querys = constructor.getHiveQuerys(worker.workerId)

        # task.stageCount = constructor.getStageCount()
        # создаем WorkerService - он будет связывать тред с файловой системой
        workerService = WorkerService(self.application.getResultPath(), worker)
        workerService.setQuery(querys)
        workerService.setTask(task)
        workerService.init()

        # создаем и запускаем тред
        workerThread = self.createHiveWorker(workerService)
        workerThread.start()

        self.redirect("/dashboard/app/" + app.code + "/#new_task/" + str(worker.workerId))