def simulate_batch(): """Ensure that the current queue run looks like a batch run to Guild. Creates a proto dir to mimick the appearance of a batch. This ensures that the queue doesn't show up in compare and other facilities that ignore batch runs by default. """ this_run = op_util.current_run() util.ensure_dir(this_run.guild_path("proto"))
import yaml from guild import op_util x = 3 y = 4 upstream_flags = yaml.load(open("upstream-flags.yml")) run = op_util.current_run() flags = run["flags"] flags.update( {"upstream-%s" % name: val for name, val in upstream_flags.items()}) run.write_attr("flags", flags) print("upstream: %s" % open("upstream-file.txt").read()) print("downstream: %s + %s = %s" % (x, y, x + y))
def _init_run(args): if args.run_dir: return runlib.for_dir(args.run_dir) return op_util.current_run()
def init_batch(new_trial_cb=None): return Batch(op_util.current_run(), new_trial_cb)