Пример #1
0
def test_object_replace():
    from pycompss.util.objects.replace import replace

    o = MyClass(1, [1, 2, 3, 4], "hello world!")
    p = MyClass(100, [40, 30, 20, 10], "goodbye world!")

    assert id(o) != id(p), "ERROR: The objects have the same identifier."

    replace(o, p)

    assert id(o) == id(
        p), "ERROR: The objects do not have the same identifier."
Пример #2
0
def test_object_replace():
    try:
        from pycompss.util.objects.replace import replace
    except ImportError:
        raise Exception("UNSUPPORTED WITH MYPY")

    o = MyClass(1, [1, 2, 3, 4], "hello world!")
    p = MyClass(100, [40, 30, 20, 10], "goodbye world!")

    assert id(o) != id(p), "ERROR: The objects have the same identifier."

    replace(o, p)

    assert id(o) == id(
        p), "ERROR: The objects do not have the same identifier."
Пример #3
0
def test_replace_main():
    from pycompss.util.objects.replace import examine_vars
    from pycompss.util.objects.replace import a
    from pycompss.util.objects.replace import U
    from pycompss.util.objects.replace import S
    from pycompss.util.objects.replace import replace
    from pycompss.util.objects.replace import b
    from pycompss.util.objects.replace import V
    from pycompss.util.objects.replace import T
    # Does the same as __main__
    examine_vars(id(a), id(U), id(S))
    print("-" * 35)
    replace(a, b)
    replace(U, V)
    replace(S, T)
    print("-" * 35)
Пример #4
0
 def sync_if_needed(obj):
     # type: (object) -> None
     if OT_is_obj_pending_to_synchronize(obj):
         new_val = compss_wait_on(obj)
         replace(obj, new_val)
Пример #5
0
 def sync_if_needed(obj):
     if must_sync(obj):
         new_val = compss_wait_on(obj)
         replace(obj, new_val)