コード例 #1
0
ファイル: test_barrier.py プロジェクト: alcidesv/jug
def test_barrier_once():
    import sys
    options = default_options.copy()
    options.jugdir = 'dict_store'
    options.jugfile = 'jug/tests/jugfiles/wbarrier.py'
    jug.jug.execute(options)
    assert 'four' in dir(sys.modules['wbarrier'])
コード例 #2
0
ファイル: test_jug_execute.py プロジェクト: wangjianze/jug
def test_failed_task():
    from jug.jug import execution_loop
    from jug.task import alltasks
    from jug.tests.jugfiles.exceptions import FailingTask
    options = default_options.copy()
    options.jugfile = os.path.join(_jugdir, 'failing.py')
    # keep_failed ensures errored tasks are marked as failed
    options.execute_keep_failed = True

    store, space = jug.jug.init(options.jugfile, 'dict_store')
    # the failing.py jugfile has a total of 20 reachable tasks
    assert len(alltasks) == 20
    # Keep a copy of all tasks to check for failed tasks later
    alltasks_copy = alltasks[:]

    try:
        execution_loop(alltasks, options)
    except FailingTask:  # Using a custom exception to make sure we don't silence any errors
        pass

    # The third task fails so we get 2 results and 1 failed lock
    # NOTE: This might be incorrect if order of execution is not guaranteed
    assert len(store.store) == 3
    # 10 tasks could be run and were taken. Only the 10 waiting remain
    assert len(alltasks) == 10
    assert len([x for x in alltasks_copy if x.is_failed()]) == 1
コード例 #3
0
def test_barrier_once():
    import sys
    options = default_options.copy()
    options.jugdir = 'dict_store'
    options.jugfile = 'jug/tests/jugfiles/wbarrier.py'
    jug.jug.execute(options)
    assert 'four' in dir(sys.modules['wbarrier'])
コード例 #4
0
ファイル: test_barrier.py プロジェクト: Javacym/jug
def test_barrier_once():
    import sys
    options = default_options.copy()
    options.jugdir = 'dict_store'
    options.jugfile = os.path.join(_jugdir, 'wbarrier.py')
    jug.jug.execute(options)
    assert 'four' in dir(sys.modules['wbarrier'])
コード例 #5
0
ファイル: test_jug_execute.py プロジェクト: wangjianze/jug
def test_failed_task_keep_going():
    from jug.jug import execution_loop
    from jug.task import alltasks
    options = default_options.copy()
    options.jugfile = os.path.join(_jugdir, 'failing.py')
    # these 3 silence errors during execution and ensure jug isn't kept waiting
    options.execute_keep_going = True
    options.execute_nr_wait_cycles = 1
    options.execute_wait_cycle_time = 0
    # keep_failed ensures errored tasks are marked as failed
    options.execute_keep_failed = True

    store, space = jug.jug.init(options.jugfile, 'dict_store')
    # the failing.py jugfile has a total of 20 reachable tasks
    assert len(alltasks) == 20
    # Keep a copy of all tasks to check for failed tasks later
    alltasks_copy = alltasks[:]

    execution_loop(alltasks, options)

    # 14 results + 3 failures
    assert len(store.store) == 17
    # 3 tasks should remain in waiting state due to 3 failures upstream
    assert len(alltasks) == 3
    assert len([x for x in alltasks_copy if x.is_failed()]) == 3
コード例 #6
0
def test_barrier_once():
    import sys
    options = default_options.copy()
    options.jugdir = 'dict_store'
    options.jugfile = os.path.join(_jugdir, 'wbarrier.py')
    jug.subcommands.execute.execute(options)
    assert 'four' in dir(sys.modules['wbarrier'])
コード例 #7
0
ファイル: test_barrier.py プロジェクト: ulido/jug
def test_barrier_once():
    import sys

    options = default_options.copy()
    options.jugdir = "dict_store"
    options.jugfile = "jug/tests/jugfiles/wbarrier.py"
    jug.jug.execute(options)
    assert "four" in dir(sys.modules["wbarrier"])
コード例 #8
0
ファイル: test_status.py プロジェクト: szaydel/jug
def test_nocache():
    store, space = jug.jug.init('jug/tests/jugfiles/simple.py', 'dict_store')
    simple_execute()

    options = default_options.copy()
    options.jugdir = store
    options.jugfile = 'jug/tests/jugfiles/simple.py'
    options.verbose = 'quiet'
    assert status.status(options) == 8 * 4
コード例 #9
0
ファイル: test_status.py プロジェクト: jameshensman/jug
def test_nocache():
    store, space = jug.jug.init('jug/tests/jugfiles/simple.py', 'dict_store')
    simple_execute()

    options = default_options.copy()
    options.jugdir = store
    options.jugfile = 'jug/tests/jugfiles/simple.py'
    options.verbose = 'quiet'
    assert status.status(options) == 8 * 4
コード例 #10
0
def test_nocache():
    jugfile = os.path.join(_jugdir, 'simple.py')
    store, space = jug.jug.init(jugfile, 'dict_store')
    simple_execute()

    options = default_options.copy()
    options.jugdir = store
    options.jugfile = jugfile
    options.verbose = 'quiet'
    assert status.status(options) == 8 * 4
コード例 #11
0
ファイル: test_status.py プロジェクト: luispedro/jug
def test_nocache():
    jugfile = os.path.join(_jugdir, 'simple.py')
    store, space = jug.jug.init(jugfile, 'dict_store')
    simple_execute()

    options = default_options.copy()
    options.jugdir = store
    options.jugfile = jugfile
    options.verbose = 'quiet'
    assert status.status(options) == 8 * 4
コード例 #12
0
ファイル: test_status.py プロジェクト: rdenham/jug
def test_cache_block_status():
    jugfile = os.path.join(_jugdir, 'block_access.py')

    options = default_options.copy()
    options.jugdir = 'dict_store'
    options.jugfile = jugfile
    options.verbose = 'quiet'
    options.status_cache = True
    options.status_cache_file = ':memory:'

    assert status.status(options) == 0
コード例 #13
0
ファイル: test_status.py プロジェクト: jameshensman/jug
def test_cache_bvalue():
    store, space = jug.jug.init('jug/tests/jugfiles/bvalue.py', 'dict_store')

    options = default_options.copy()
    options.jugdir = store
    options.jugfile = 'jug/tests/jugfiles/bvalue.py'
    options.verbose = 'quiet'
    options.status_mode = 'cached'
    options.status_cache_file = ':memory:'

    assert status.status(options) == 0
    simple_execute()
    assert status.status(options) == 1
コード例 #14
0
ファイル: test_compound.py プロジェクト: asford/jug
def test_debug():
    from jug.options import default_options
    options = default_options.copy()
    options.debug = True

    store, space = jug.jug.init('jug/tests/jugfiles/compound.py', 'dict_store')
    simple_execute(options = options)

    assert 'sixteen' in space
    assert space['sixteen'].result == 16
    store, space = jug.jug.init('jug/tests/jugfiles/compound.py', store)
    assert 'sixteen' in space
    assert space['sixteen'].result == 16
コード例 #15
0
ファイル: test_jug_execute.py プロジェクト: luispedro/jug
def test_target_wild():
    from jug.jug import execution_loop
    from jug.task import alltasks
    options = default_options.copy()
    options.jugfile = os.path.join(_jugdir, 'simple_multiple.py')
    # Test if restricting to this target we skip the other tasks
    options.execute_target = "simple_multiple.sum_"

    store, space = jug.jug.init(options.jugfile, 'dict_store')
    execution_loop(alltasks, options)

    assert len(store.store) < len(alltasks)
    assert len(store.store) == 16
コード例 #16
0
def test_target_wild():
    from jug.jug import execution_loop
    from jug.task import alltasks
    options = default_options.copy()
    options.jugfile = os.path.join(_jugdir, 'simple_multiple.py')
    # Test if restricting to this target we skip the other tasks
    options.execute_target = "simple_multiple.sum_"

    store, space = jug.jug.init(options.jugfile, 'dict_store')
    execution_loop(alltasks, options)

    assert len(store.store) < len(alltasks)
    assert len(store.store) == 16
コード例 #17
0
ファイル: test_status.py プロジェクト: asford/jug
def test_cache_bvalue():
    store, space = jug.jug.init('jug/tests/jugfiles/bvalue.py', 'dict_store')

    options = default_options.copy()
    options.jugdir = store
    options.jugfile = 'jug/tests/jugfiles/bvalue.py'
    options.verbose = 'quiet'
    options.status_mode = 'cached'
    options.status_cache_file = ':memory:'

    assert status.status(options) == 0
    simple_execute()
    assert status.status(options) == 1
コード例 #18
0
ファイル: test_jug_execute.py プロジェクト: asford/jug
def test_aggressive_unload():
    from jug.options import default_options
    options = default_options.copy()
    options.aggressive_unload = True

    @task_reset
    def run_jugfile(jugfile):
        store, space = jug.jug.init(jugfile, 'dict_store')
        simple_execute(options=options)
    yield run_jugfile, 'jug/tests/jugfiles/tasklet_simple.py'
    yield run_jugfile, 'jug/tests/jugfiles/tasklets.py'
    yield run_jugfile, 'jug/tests/jugfiles/barrier_mapreduce.py'
    yield run_jugfile, 'jug/tests/jugfiles/compound_nonsimple.py'
    yield run_jugfile, 'jug/tests/jugfiles/slice_task.py'
コード例 #19
0
ファイル: test_status.py プロジェクト: luispedro/jug
def test_cache_bvalue():
    jugfile = os.path.join(_jugdir, 'bvalue.py')
    store, space = jug.jug.init(jugfile, 'dict_store')

    options = default_options.copy()
    options.jugdir = store
    options.jugfile = jugfile
    options.verbose = 'quiet'
    options.status_cache = True
    options.status_cache_file = ':memory:'

    assert status.status(options) == 0
    simple_execute()
    assert status.status(options) == 1
コード例 #20
0
ファイル: test_compound.py プロジェクト: jameshensman/jug
def test_debug():
    from jug.jug import execution_loop
    from jug.task import alltasks
    from jug.options import default_options
    options = default_options.copy()
    options.debug = True

    store, space = jug.jug.init('jug/tests/jugfiles/compound.py', 'dict_store')
    execution_loop(alltasks, options)
    assert 'sixteen' in space
    assert space['sixteen'].result == 16
    store, space = jug.jug.init('jug/tests/jugfiles/compound.py', store)
    assert 'sixteen' in space
    assert space['sixteen'].result == 16
コード例 #21
0
ファイル: test_compound.py プロジェクト: abingham/jug
def test_debug():
    from jug.jug import execution_loop
    from jug.task import alltasks
    from jug.options import default_options
    options = default_options.copy()
    options.debug = True

    store, space = jug.jug.init('jug/tests/jugfiles/compound.py', 'dict_store')
    execution_loop(alltasks, options)
    assert 'sixteen' in space
    assert space['sixteen'].result == 16
    store, space = jug.jug.init('jug/tests/jugfiles/compound.py', store)
    assert 'sixteen' in space
    assert space['sixteen'].result == 16
コード例 #22
0
def test_cache_bvalue():
    jugfile = os.path.join(_jugdir, 'bvalue.py')
    store, space = jug.jug.init(jugfile, 'dict_store')

    options = default_options.copy()
    options.jugdir = store
    options.jugfile = jugfile
    options.verbose = 'quiet'
    options.status_cache = True
    options.status_cache_file = ':memory:'

    assert status.status(options) == 0
    simple_execute()
    assert status.status(options) == 1
コード例 #23
0
ファイル: test_jug_execute.py プロジェクト: wangjianze/jug
def test_aggressive_unload():
    from jug.jug import execution_loop
    from jug.task import alltasks
    from jug.options import default_options
    options = default_options.copy()
    options.aggressive_unload = True
    @task_reset
    def run_jugfile(jugfile):
        store, space = jug.jug.init(jugfile, 'dict_store')
        execution_loop(alltasks, options)
    yield run_jugfile, os.path.join(_jugdir, 'tasklet_simple.py')
    yield run_jugfile, os.path.join(_jugdir, 'tasklets.py')
    yield run_jugfile, os.path.join(_jugdir, 'barrier_mapreduce.py')
    yield run_jugfile, os.path.join(_jugdir, 'compound_nonsimple.py')
    yield run_jugfile, os.path.join(_jugdir, 'slice_task.py')
コード例 #24
0
ファイル: test_jug_execute.py プロジェクト: Javacym/jug
def test_aggressive_unload():
    from jug.jug import execution_loop
    from jug.task import alltasks
    from jug.options import default_options
    options = default_options.copy()
    options.aggressive_unload = True
    @task_reset
    def run_jugfile(jugfile):
        store, space = jug.jug.init(jugfile, 'dict_store')
        execution_loop(alltasks, options)
    yield run_jugfile, os.path.join(_jugdir, 'tasklet_simple.py')
    yield run_jugfile, os.path.join(_jugdir, 'tasklets.py')
    yield run_jugfile, os.path.join(_jugdir, 'barrier_mapreduce.py')
    yield run_jugfile, os.path.join(_jugdir, 'compound_nonsimple.py')
    yield run_jugfile, os.path.join(_jugdir, 'slice_task.py')
コード例 #25
0
ファイル: test_compound.py プロジェクト: Javacym/jug
def test_debug():
    from jug.jug import execution_loop
    from jug.task import alltasks
    from jug.options import default_options
    options = default_options.copy()
    options.debug = True
    jugfile = os.path.join(_jugdir, 'compound.py')

    store, space = jug.jug.init(jugfile, 'dict_store')
    execution_loop(alltasks, options)
    assert 'sixteen' in space
    assert space['sixteen'].result == 16
    store, space = jug.jug.init(jugfile, store)
    assert 'sixteen' in space
    assert space['sixteen'].result == 16
コード例 #26
0
ファイル: test_status.py プロジェクト: asford/jug
def test_cache():
    store, _ = jug.jug.init('jug/tests/jugfiles/simple.py', 'dict_store')
    while jug.task.alltasks:
        jug.task.alltasks.pop()

    options = default_options.copy()
    options.jugdir = store
    options.jugfile = 'jug/tests/jugfiles/simple.py'
    options.verbose = 'quiet'
    options.status_mode = 'cached'
    options.status_cache_file = ':memory:'

    assert status.status(options) == 0
    simple_execute()
    assert status.status(options) == 8 * 4
コード例 #27
0
def test_debug():
    from jug.jug import execution_loop
    from jug.task import alltasks
    from jug.options import default_options
    options = default_options.copy()
    options.debug = True
    jugfile = os.path.join(_jugdir, 'compound.py')

    store, space = jug.jug.init(jugfile, 'dict_store')
    execution_loop(alltasks, options)
    assert 'sixteen' in space
    assert space['sixteen'].result == 16
    store, space = jug.jug.init(jugfile, store)
    assert 'sixteen' in space
    assert space['sixteen'].result == 16
コード例 #28
0
def test_aggressive_unload():
    from jug.jug import execution_loop
    from jug.task import alltasks
    from jug.options import default_options
    from collections import defaultdict
    options = default_options.copy()
    options.aggressive_unload = True

    @task_reset
    def run_jugfile(jugfile):
        store, space = jug.jug.init(jugfile, 'dict_store')
        execution_loop(alltasks, options, defaultdict(int), defaultdict(int))

    yield run_jugfile, 'jug/tests/jugfiles/tasklet_simple.py'
    yield run_jugfile, 'jug/tests/jugfiles/tasklets.py'
    yield run_jugfile, 'jug/tests/jugfiles/barrier_mapreduce.py'
    yield run_jugfile, 'jug/tests/jugfiles/compound_nonsimple.py'
    yield run_jugfile, 'jug/tests/jugfiles/slice_task.py'