Пример #1
0
    def run_job(self, qobj):
        """ Main dummy simulator loop """
        job_id = str(uuid.uuid4())
        time.sleep(self.time_alive)

        return Result(
            {'job_id': job_id, 'result': [], 'status': 'COMPLETED'})
Пример #2
0
    def run_job(self, job_id, qobj):
        """ Main dummy simulator loop """
        time.sleep(self.time_alive)

        return Result.from_dict({
            'job_id': job_id,
            'result': [],
            'status': 'COMPLETED'
        })
Пример #3
0
def recover(s):
    with open(s + '.pkl', 'rb') as f:
        qobj = pickle.load(f)
    jids = open(s, "r").read().strip().split("\n")
    c = 1
    b = True
    xs = []
    for jid in jids:
        x = api.get_job(jid)
        print(c, x.get("status"))
        if x.get("status") != "COMPLETED":
            b = False
        xs += x["qasms"]
        c += 1
    if not b:
        sys.exit(1)
    return Result({"result": xs, "status": "DONE"}, qobj)
Пример #4
0
    def run(self, q_job):
        """ Main dummy simulator loop """
        job_id = str(uuid.uuid4())
        qobj = q_job.qobj
        timeout = q_job.timeout
        wait_time = q_job.wait

        time_passed = 0
        while time_passed <= self.time_alive:
            Event().wait(timeout=wait_time)
            time_passed += wait_time
            if time_passed >= timeout:
                raise QISKitError('Dummy backend has timed out!')

        return Result({
            'job_id': job_id,
            'result': [],
            'status': 'COMPLETED'
        }, qobj)