Exemplo n.º 1
0
    def set_optimization_tag(self, fractal_uri, tag, dataset_name):
        from qcportal.models.task_models import PriorityEnum

        client = FractalClient(fractal_uri, verify=False)

        optds = client.get_collection("OptimizationDataset", dataset_name)
        optds.status()
        opts = optds.df.values.flatten()

        optids = [opt.id for opt in opts if opt.status != 'COMPLETE']
        for id in optids:
            client.modify_tasks(operation='modify',
                                base_result=id,
                                new_tag=tag)
Exemplo n.º 2
0
    def set_optimization_priority(self, fractal_uri, priority, dataset_name):
        from qcportal.models.task_models import PriorityEnum

        client = FractalClient(fractal_uri, verify=False)

        optds = client.get_collection("OptimizationDataset", dataset_name)
        optds.status()
        opts = optds.df.values.flatten()

        priority_map = {
            "high": PriorityEnum.HIGH,
            "normal": PriorityEnum.NORMAL,
            "low": PriorityEnum.LOW
        }

        optids = [opt.id for opt in opts if opt.status != 'COMPLETE']
        for id in optids:
            client.modify_tasks(operation='modify',
                                base_result=id,
                                new_priority=priority_map[priority])
Exemplo n.º 3
0
    def errorcycle_optimizations(self,
                                 fractal_uri,
                                 dataset_name,
                                 client=None,
                                 compute_specs=None,
                                 molids=None):
        """Restart optimizations that have failed.

        Parameters
        ----------
        compute_specs : iterable 
            Iterable of compute spec names to error cycle only.
        molids : iterable 
            Iterable of molecule ids to error cycle only.
    
        """
        if client is None:
            client = FractalClient(fractal_uri, verify=False)

        optds = client.get_collection("OptimizationDataset", dataset_name)
        optds.status()

        df = optds.df

        if (molids is not None) and (len(molids) != 0):
            df = df.loc[list(molids)]

        if compute_specs is not None:
            df = df[compute_specs]

        for opt in df.values.flatten():
            if opt.status == 'ERROR':
                client.modify_tasks(operation='restart', base_result=opt.id)
                print(f"Restarted ERRORed optimization `{opt.id}`")
            if opt.status == 'INCOMPLETE' and (opt.final_molecule is not None):
                client.modify_tasks(operation='regenerate', base_result=opt.id)
                print(f"Regnerated INCOMPLETE optimization `{opt.id}`")