Skip to content

WIP: compilation-queue BLACS implementation #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions blacs/experiment_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from labscript_utils.qtwidgets.elide_label import elide_label
from labscript_utils.connections import ConnectionTable
import labscript_utils.properties
from runmanager import new_rep_name

from blacs.tab_base_classes import MODE_MANUAL, MODE_TRANSITION_TO_BUFFERED, MODE_TRANSITION_TO_MANUAL, MODE_BUFFERED
import blacs.plugins as plugins
Expand Down Expand Up @@ -389,10 +390,7 @@ def process_request(self,h5_filepath):
rerun = False
if rerun or self.is_in_queue(h5_filepath):
self._logger.debug('Run file has already been run! Creating a fresh copy to rerun')
new_h5_filepath, repeat_number = self.new_rep_name(h5_filepath)
# Keep counting up until we get a filename that isn't in the filesystem:
while os.path.exists(new_h5_filepath):
new_h5_filepath, repeat_number = self.new_rep_name(new_h5_filepath)
new_h5_filepath, repeat_number = new_rep_name(h5_filepath)
success = self.clean_h5_file(h5_filepath, new_h5_filepath, repeat_number=repeat_number)
if not success:
return 'Cannot create a re run of this experiment. Is it a valid run file?'
Expand All @@ -419,19 +417,6 @@ def process_request(self,h5_filepath):
"The error was %s\n"%error)
return message

def new_rep_name(self, h5_filepath):
basename, ext = os.path.splitext(h5_filepath)
if '_rep' in basename and ext == '.h5':
reps = basename.split('_rep')[-1]
try:
reps = int(reps)
except ValueError:
# not a rep
pass
else:
return ''.join(basename.split('_rep')[:-1]) + '_rep%05d.h5' % (reps + 1), reps + 1
return basename + '_rep%05d.h5' % 1, 1

def clean_h5_file(self, h5file, new_h5_file, repeat_number=0):
try:
with h5py.File(h5file, 'r') as old_file:
Expand Down Expand Up @@ -521,7 +506,16 @@ def manage(self):
timeout_limit = 300 #seconds
self.set_status("Idle")

import runmanager.remote
from qtutils import inmain
client = runmanager.remote.Client(timeout=5)

while self.manager_running:
try:
client.advise_BLACS_shots_remaining(inmain(self._model.rowCount))
except Exception:
logger.exception("error telling runmanager how many shots are remaining")

# If the pause button is pushed in, sleep
if self.manager_paused:
if self.get_status() == "Idle":
Expand Down