Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 16fdebad8e1d
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 53cef7e695e7
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on May 3, 2016

  1. Copy the full SHA
    5b955e8 View commit details
  2. Copy the full SHA
    7803b68 View commit details
  3. Copy the full SHA
    53cef7e View commit details
Showing with 15 additions and 20 deletions.
  1. +1 −14 artiq/master/worker_db.py
  2. +14 −6 artiq/master/worker_impl.py
15 changes: 1 addition & 14 deletions artiq/master/worker_db.py
Original file line number Diff line number Diff line change
@@ -3,11 +3,8 @@
import logging
import os
import tempfile
import time
import re

import h5py

from artiq.protocols.sync_struct import Notifier
from artiq.protocols.pc_rpc import AutoTarget, Client, BestEffortClient

@@ -148,15 +145,6 @@ def close_devices(self):
self.active_devices.clear()


def get_hdf5_output(start_time, rid, name):
dirname = os.path.join("results",
time.strftime("%Y-%m-%d", start_time),
time.strftime("%H-%M", start_time))
filename = "{:09}-{}.h5".format(rid, name)
os.makedirs(dirname, exist_ok=True)
return h5py.File(os.path.join(dirname, filename), "w")


class DatasetManager:
def __init__(self, ddb):
self.broadcast = Notifier(dict())
@@ -190,6 +178,5 @@ def get(self, key):
return self.ddb.get(key)

def write_hdf5(self, f):
g = f.create_group("datasets")
for k, v in self.local.items():
g[k] = v
f[k] = v
20 changes: 14 additions & 6 deletions artiq/master/worker_impl.py
Original file line number Diff line number Diff line change
@@ -5,11 +5,12 @@
import traceback
from collections import OrderedDict

import h5py

import artiq
from artiq.protocols import pipe_ipc, pyon
from artiq.tools import multiline_log_config, file_import
from artiq.master.worker_db import (DeviceManager, DatasetManager,
get_hdf5_output)
from artiq.master.worker_db import DeviceManager, DatasetManager
from artiq.language.environment import is_experiment
from artiq.language.core import set_watchdog_factory, TerminationRequested
from artiq.coredevice.core import CompileError, host_only, _render_diagnostic
@@ -209,6 +210,11 @@ def main():
exp = get_exp(experiment_file, expid["class_name"])
device_mgr.virtual_devices["scheduler"].set_run_info(
rid, obj["pipeline_name"], expid, obj["priority"])
dirname = os.path.join("results",
time.strftime("%Y-%m-%d", start_time),
time.strftime("%H-%M", start_time))
os.makedirs(dirname, exist_ok=True)
os.chdir(dirname)
exp_inst = exp(
device_mgr, dataset_mgr, enable_processors=True,
**expid["arguments"])
@@ -223,11 +229,13 @@ def main():
exp_inst.analyze()
put_object({"action": "completed"})
elif action == "write_results":
with get_hdf5_output(start_time, rid, exp.__name__) as f:
dataset_mgr.write_hdf5(f)
filename = "{:09}-{}.h5".format(rid, exp.__name__)
with h5py.File(filename, "w") as f:
dataset_mgr.write_hdf5(f.create_group("datasets"))
f["artiq_version"] = artiq_version
if "repo_rev" in expid:
f["repo_rev"] = expid["repo_rev"]
f["rid"] = rid
f["start_time"] = start_time
f["expid"] = pyon.encode(expid)
put_object({"action": "completed"})
elif action == "examine":
examine(ExamineDeviceMgr, ParentDatasetDB, obj["file"])