qcfractal/queue/handlers.py
def post(self):
        """Posts new services to the service queue.
        """

        body_model, response_model = rest_model("service_queue", "post")
        body = self.parse_bodymodel(body_model)

        new_services = []
        for service_input in body.data:
            # Get molecules with ids
            if isinstance(service_input.initial_molecule, list):
                molecules = self.storage.get_add_molecules_mixed(service_input.initial_molecule)["data"]
                if len(molecules) != len(service_input.initial_molecule):
                    raise KeyError("We should catch this error.")
            else:
                molecules = self.storage.get_add_molecules_mixed([service_input.initial_molecule])["data"][0]

            # Update the input and build a service object
            service_input = service_input.copy(update={"initial_molecule": molecules})
            new_services.append(
                initialize_service(
                    self.storage, self.logger, service_input, tag=body.meta.tag, priority=body.meta.priority
                )
            )

        ret = self.storage.add_services(new_services)
        ret["data"] = {"ids": ret["data"], "existing": ret["meta"]["duplicates"]}
        ret["data"]["submitted"] = list(set(ret["data"]["ids"]) - set(ret["meta"]["duplicates"]))
        response = response_model(**ret)

        self.logger.info("POST: ServiceQueue -  Added {} services.\n".format(response.meta.n_inserted))
        self.write(response)
Posts new services to the service queue.
        
Posts new services to the service queue.
Posts new services to the service queue .
def post(self):
        body_model, response_model = rest_model("service_queue", "post")
        body = self.parse_bodymodel(body_model)
        new_services = []
        for service_input in body.data:
            if isinstance(service_input.initial_molecule, list):
                molecules = self.storage.get_add_molecules_mixed(service_input.initial_molecule)["data"]
                if len(molecules) != len(service_input.initial_molecule):
                    raise KeyError("We should catch this error.")
            else:
                molecules = self.storage.get_add_molecules_mixed([service_input.initial_molecule])["data"][0]
            service_input = service_input.copy(update={"initial_molecule": molecules})
            new_services.append(
                initialize_service(
                    self.storage, self.logger, service_input, tag=body.meta.tag, priority=body.meta.priority
                )
            )
        ret = self.storage.add_services(new_services)
        ret["data"] = {"ids": ret["data"], "existing": ret["meta"]["duplicates"]}
        ret["data"]["submitted"] = list(set(ret["data"]["ids"]) - set(ret["meta"]["duplicates"]))
        response = response_model(**ret)
        self.logger.info("POST: ServiceQueue -  Added {} services.\n".format(response.meta.n_inserted))
        self.write(response)
def post ( self ) : body_model , response_model = rest_model ( "service_queue" , "post" ) body = self . parse_bodymodel ( body_model ) new_services = [ ] for service_input in body . data : if isinstance ( service_input . initial_molecule , list ) : molecules = self . storage . get_add_molecules_mixed ( service_input . initial_molecule ) [ "data" ] if len ( molecules ) != len ( service_input . initial_molecule ) : raise KeyError ( "We should catch this error." ) else : molecules = self . storage . get_add_molecules_mixed ( [ service_input . initial_molecule ] ) [ "data" ] [ 0 ] service_input = service_input . copy ( update = { "initial_molecule" : molecules } ) new_services . append ( initialize_service ( self . storage , self . logger , service_input , tag = body . meta . tag , priority = body . meta . priority ) ) ret = self . storage . add_services ( new_services ) ret [ "data" ] = { "ids" : ret [ "data" ] , "existing" : ret [ "meta" ] [ "duplicates" ] } ret [ "data" ] [ "submitted" ] = list ( set ( ret [ "data" ] [ "ids" ] ) - set ( ret [ "meta" ] [ "duplicates" ] ) ) response = response_model ( ** ret ) self . logger . info ( "POST: ServiceQueue -  Added {} services.\n" . format ( response . meta . n_inserted ) ) self . write ( response )
Posts new services to the service queue.
Posts new services to the service queue .
"""Posts new services to the service queue.
        """ # Get molecules with ids # Update the input and build a service object
self