forked from M-Labs/artiq
master: make RIDs unique across restarts
This commit is contained in:
parent
ceb02b42cb
commit
6601bebcfe
|
@ -9,7 +9,7 @@ from artiq.protocols.pc_rpc import Server
|
||||||
from artiq.protocols.sync_struct import Publisher
|
from artiq.protocols.sync_struct import Publisher
|
||||||
from artiq.protocols.file_db import FlatFileDB, SimpleHistory
|
from artiq.protocols.file_db import FlatFileDB, SimpleHistory
|
||||||
from artiq.master.scheduler import Scheduler
|
from artiq.master.scheduler import Scheduler
|
||||||
from artiq.master.results import RTResults
|
from artiq.master.results import RTResults, get_last_rid
|
||||||
from artiq.master.repository import Repository
|
from artiq.master.repository import Repository
|
||||||
from artiq.tools import verbosity_args, init_logger
|
from artiq.tools import verbosity_args, init_logger
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ def main():
|
||||||
|
|
||||||
def run_cb(rid, run_params):
|
def run_cb(rid, run_params):
|
||||||
rtr.current_group = run_params["rtr_group"]
|
rtr.current_group = run_params["rtr_group"]
|
||||||
scheduler = Scheduler(run_cb)
|
scheduler = Scheduler(run_cb, get_last_rid() + 1)
|
||||||
scheduler.worker.handlers = {
|
scheduler.worker.handlers = {
|
||||||
"req_device": ddb.request,
|
"req_device": ddb.request,
|
||||||
"req_parameter": pdb.request,
|
"req_parameter": pdb.request,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import re
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
import h5py
|
import h5py
|
||||||
|
@ -16,6 +17,36 @@ def get_hdf5_output(start_time, rid, name):
|
||||||
return h5py.File(os.path.join(dirname, filename), "w")
|
return h5py.File(os.path.join(dirname, filename), "w")
|
||||||
|
|
||||||
|
|
||||||
|
def get_last_rid():
|
||||||
|
r = -1
|
||||||
|
try:
|
||||||
|
day_folders = os.listdir("results")
|
||||||
|
except:
|
||||||
|
return r
|
||||||
|
day_folders = filter(lambda x: re.fullmatch('\d\d\d\d-\d\d-\d\d', x),
|
||||||
|
day_folders)
|
||||||
|
for df in day_folders:
|
||||||
|
day_path = os.path.join("results", df)
|
||||||
|
try:
|
||||||
|
minute_folders = os.listdir(day_path)
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
minute_folders = filter(lambda x: re.fullmatch('\d\d-\d\d', x),
|
||||||
|
minute_folders)
|
||||||
|
for mf in minute_folders:
|
||||||
|
minute_path = os.path.join(day_path, mf)
|
||||||
|
try:
|
||||||
|
h5files = os.listdir(minute_path)
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
for x in h5files:
|
||||||
|
m = re.fullmatch('(\d\d\d\d\d\d\d\d\d)-.*\.h5', x)
|
||||||
|
rid = int(m.group(1))
|
||||||
|
if rid > r:
|
||||||
|
r = rid
|
||||||
|
return r
|
||||||
|
|
||||||
|
|
||||||
_type_to_hdf5 = {
|
_type_to_hdf5 = {
|
||||||
int: h5py.h5t.STD_I64BE,
|
int: h5py.h5t.STD_I64BE,
|
||||||
float: h5py.h5t.IEEE_F64BE
|
float: h5py.h5t.IEEE_F64BE
|
||||||
|
|
|
@ -6,10 +6,10 @@ from artiq.master.worker import Worker
|
||||||
|
|
||||||
|
|
||||||
class Scheduler:
|
class Scheduler:
|
||||||
def __init__(self, run_cb):
|
def __init__(self, run_cb, first_rid):
|
||||||
self.run_cb = run_cb
|
self.run_cb = run_cb
|
||||||
self.worker = Worker()
|
self.worker = Worker()
|
||||||
self.next_rid = 0
|
self.next_rid = first_rid
|
||||||
self.queue = Notifier([])
|
self.queue = Notifier([])
|
||||||
self.queue_modified = asyncio.Event()
|
self.queue_modified = asyncio.Event()
|
||||||
self.timed = Notifier(dict())
|
self.timed = Notifier(dict())
|
||||||
|
|
Loading…
Reference in New Issue