Skip to content

Commit 58ed6db

Browse files
committed
save_labscripts()'s calls to git/hg for a given file now run in parallel.
1 parent df4e17f commit 58ed6db

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

labscript/labscript.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,18 +2201,24 @@ def save_labscripts(hdf5_file):
22012201
hdf5_file.create_dataset(save_path, data=open(path).read())
22022202
if compiler.save_hg_info:
22032203
hg_commands = [['log', '--limit', '1'], ['status'], ['diff']]
2204+
process_list = []
22042205
for command in hg_commands:
22052206
process = subprocess.Popen(['hg'] + command + [os.path.split(path)[1]], cwd=os.path.split(path)[0],
22062207
stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=startupinfo)
2208+
process_list.append(process)
2209+
for process, command in zip(process_list, hg_commands):
22072210
info, err = process.communicate()
22082211
if info or err:
22092212
hdf5_file[save_path].attrs['hg ' + str(command[0])] = info.decode('utf-8') + '\n' + err.decode('utf-8')
22102213
if compiler.save_git_info:
22112214
module_filename = os.path.split(path)[1]
22122215
git_commands = [['branch', '--show-current'], ['rev-parse', '--verify', 'HEAD'], ['diff', 'HEAD', module_filename]]
2216+
process_list = []
22132217
for command in git_commands:
22142218
process = subprocess.Popen(['git'] + command, cwd=os.path.split(path)[0], stdout=subprocess.PIPE,
22152219
stderr=subprocess.PIPE, startupinfo=startupinfo)
2220+
process_list.append(process)
2221+
for process, command in zip(process_list, git_commands):
22162222
info, err = process.communicate()
22172223
hdf5_file[save_path].attrs['git ' + str(command[0])] = info.decode('utf-8') + '\n' + err.decode('utf-8')
22182224
except ImportError:

0 commit comments

Comments
 (0)