Exemple #1
0
    def get_processor(self) -> 'Optional[engine_processor.EngineProcessor]':
        """Returns the EngineProcessor for the processor the job is/was run on,
        if available, else None."""
        status = self._inner_job().execution_status
        if not status.processor_name:
            return None
        import cirq_google.engine.engine_processor as engine_processor

        ids = engine_client._ids_from_processor_name(status.processor_name)
        return engine_processor.EngineProcessor(ids[0], ids[1], self.context)
Exemple #2
0
    def list_processors(self) -> List[engine_processor.EngineProcessor]:
        """Returns a list of Processors that the user has visibility to in the
        current Engine project. The names of these processors are used to
        identify devices when scheduling jobs and gathering calibration metrics.

        Returns:
            A list of EngineProcessors to access status, device and calibration
            information.
        """
        response = self.context.client.list_processors(self.project_id)
        return [
            engine_processor.EngineProcessor(
                self.project_id,
                engine_client._ids_from_processor_name(p.name)[1],
                self.context, p) for p in response
        ]
Exemple #3
0
 def processor_ids(self) -> List[str]:
     """Returns the processor ids provided when the job was created."""
     return [
         engine_client._ids_from_processor_name(p)[1]
         for p in self._inner_job().scheduling_config.processor_selector.processor_names
     ]