Пример #1
0
 def parameters(cls):
     parameters = [
         ParameterFactory.file_uuid(PROBES, PROBES_COLLECTION),
         ParameterFactory.file_uuid(TARGETS, TARGETS_COLLECTION),
         ParameterFactory.boolean("absorb", "Check for absorbed probes."),
         ParameterFactory.integer("num",
                                  "Minimum number of probes for a target.",
                                  default=3,
                                  minimum=1),
         ParameterFactory.lc_string(JOB_NAME,
                                    "Unique name to give this job.")
     ]
     return parameters
Пример #2
0
    def process_request(cls, params_dict):
        probes_file_uuid = params_dict[ParameterFactory.file_uuid(
            "probes", PROBES_COLLECTION)][0]
        targets_file_uuid = params_dict[ParameterFactory.file_uuid(
            "targets", TARGETS_COLLECTION)][0]
        absorb = params_dict[ParameterFactory.boolean(
            "absorb", "Check for absorbed probes.")][0]
        num = params_dict[ParameterFactory.integer(
            "num",
            "Minimum number of probes for a target.",
            default=3,
            minimum=1)][0]
        job_name = params_dict[ParameterFactory.lc_string(
            JOB_NAME, "Unique name to give this job.")][0]

        json_response = {
            PROBES: probes_file_uuid,
            TARGETS: targets_file_uuid,
            ABSORB: absorb,
            NUM: num,
            UUID: str(uuid4()),
            STATUS: JOB_STATUS.submitted,  # @UndefinedVariable
            JOB_NAME: job_name,
            DATESTAMP: datetime.today(),
        }
        http_status_code = 200

        if job_name in cls._DB_CONNECTOR.distinct(VALIDATION_COLLECTION,
                                                  JOB_NAME):
            http_status_code = 403
        else:
            try:
                probes_path = cls._DB_CONNECTOR.find_one(
                    PROBES_COLLECTION, UUID, probes_file_uuid)[FILEPATH]
                targets_path = cls._DB_CONNECTOR.find_one(
                    TARGETS_COLLECTION, UUID, targets_file_uuid)[FILEPATH]

                #ADD VALIDATOR JOB TO QUEUE

                cls._DB_CONNECTOR.insert(VALIDATION_COLLECTION,
                                         [json_response])
                del json_response[ID]
            except:
                APP_LOGGER.exception(traceback.format_exc())
                json_response[ERROR] = str(sys.exc_info()[1])
                http_status_code = 500

        return make_clean_response(json_response, http_status_code)
Пример #3
0
    def parameters(cls):
        cls._probes_param = ParameterFactory.file_uuid(PROBES,
                                                       PROBES_COLLECTION)
        cls._targets_param = ParameterFactory.file_uuid(
            TARGETS, TARGETS_COLLECTION)
        cls._strict_param   = ParameterFactory.integer(STRICT, "Restrict " \
            "each probe to this number of bases from the 3' end of its " \
            "sequence (0 to use entire probe)", default=0, minimum=0)
        cls._job_name_param = ParameterFactory.cs_string(JOB_NAME,
                                                         "Unique name to " \
                                                         "give this job.")

        parameters = [
            cls._probes_param,
            cls._targets_param,
            cls._strict_param,
            cls._job_name_param,
        ]
        return parameters