def test_outdated_data_simple_dependency(tmp_directory): """ A -> B """ dag = DAG() fa = Path('a.txt') fb = Path('b.txt') ta = PythonCallable(touch_root, File(fa), dag, 'ta') tb = PythonCallable(touch, File(fb), dag, 'tb') ta >> tb ta.render() tb.render() assert not ta.product.exists() assert not tb.product.exists() assert ta.product._is_outdated() assert tb.product._is_outdated() dag.build() dag._clear_metadata() # they both exist now assert ta.product.exists() assert tb.product.exists() # and arent outdated... assert not ta.product._is_outdated() assert not tb.product._is_outdated() # let's make b outdated ta.build(force=True) dag._clear_metadata() assert not ta.product._is_outdated() assert tb.product._is_outdated()
def test_many_upstream(tmp_directory): """ {A, B} -> C """ dag = DAG() fa = Path('a.txt') fb = Path('b.txt') fc = Path('c.txt') ta = PythonCallable(touch_root, File(fa), dag, 'ta') tb = PythonCallable(touch_root, File(fb), dag, 'tb') tc = PythonCallable(touch, File(fc), dag, 'tc') (ta + tb) >> tc dag.build() assert ta.product.exists() assert tb.product.exists() assert tc.product.exists() assert not ta.product._is_outdated() assert not tb.product._is_outdated() assert not tc.product._is_outdated() ta.build(force=True) dag._clear_metadata() assert not ta.product._is_outdated() assert not tb.product._is_outdated() assert tc.product._is_outdated() dag.build() tb.build(force=True) dag._clear_metadata() assert not ta.product._is_outdated() assert not tb.product._is_outdated() assert tc.product._is_outdated()