def run_exp(args):
    # command expansion must be done in two phases:
    #  first, inputs are expanded and indentified
    #  then, the experimental hash is computed and substituted

    # if arguments are partially specified, fill them in from previous
    # runs
    args = fill_last_args(args)

    # now fill in any missing arguments that have defaults
    args = fill_defaults(args)

    # now make sure we have all the necessary arguments
    check_args(args)

    # find out the hash of experimental commit
    hsh = util.exec_output(['git', 'rev-parse', args.commit]).strip()

    # parse parameters from command line
    params = parse_params(args.params)

    job = dag.dag_node(args.description, params, hsh, args.command, rerun = args.rerun, subdir_only = args.subdir_only)
    jobs = dag.dag([job,])
    lb = local_backend.local_backend()
    jobs.backend = lb
    jobs.mainloop()
def run():
    toplevel_nodes = []
    for nodeGroup in nodes:
        for node in nodes[nodeGroup]:
            if not node.parents:
                toplevel_nodes += [node]

    mydag = dag.dag(toplevel_nodes)
    mydag.backend = local_backend.local_backend()
    status = mydag.mainloop()
    if status == dag.RUN_STATE_SUCCESS:
        print "Task completed successfully."
    elif status == dag.RUN_STATE_FAIL:
        print "Task failed!"
    else:
        print "Unrecognized exit status"
#!/usr/bin/env python
import dag, util, local_backend
import time

# this file is just for testing; if a user actually wanted to run a
# job they'd use exp.py.

hsh = util.exec_output(['git', 'rev-parse', 'HEAD']).strip()

test_node = dag.dag_node(desc = "testscript", commit = hsh, command = "./test.sh")
test_node2=dag.dag_node(desc = "testscript2", commit = hsh, command = "./test2.sh {testscript}/log")

test_node2.add_parents(set([test_node,]));
test_dag = dag.dag([test_node,])
lb = local_backend.local_backend()
test_dag.backend = lb

test_dag.mainloop()