예제 #1
0
파일: pscos.py 프로젝트: giulange/compss
def basic_3_test():
    # type: () -> bool
    """ Basic test 3

    This Test:
        - Instantiates a SCO.
        - Makes it persistent.
        - Calls a task within that PSCO -> self INOUT
            - The task increments its value.
        - Calls it again.
        - Calls it again.
        - Waits for the self result.

    :return: True if success. False otherwise.
    """
    p = MySO(1)
    p.makePersistent()
    p.increment()
    p.increment()
    p.increment()
    p = compss_wait_on(p)
    print("p: " + str(p.get()))
    if p.get() == 4:
        print("- Complex Test Python PSCOs: OK")
        return True
    else:
        print("- Complex Test Python PSCOs: ERROR")
        return False
예제 #2
0
파일: pscos.py 프로젝트: giulange/compss
def basic_2_test():
    # type: () -> bool
    """ Basic test 2

    This Test:
        - Instantiates a SCO.
        - Makes it persistent.
        - Calls a task with that PSCO -> IN parameter.
            - The task receives the PSCO and gets its value.
            - Instantiates another SCO and makes it persistent within the task.
            - Returns the new PSCO.
        - Calls another task with the input from the first one.
            - Gets the output PSCO and receives it as input.
        - Waits for the first task result.
        - Waits for the second task result.

    :return: True if success. False otherwise.
    """
    p = MySO(1)
    p.makePersistent()
    x = complex_task(p)
    y = simple_task(x)
    res1 = compss_wait_on(x)
    res2 = compss_wait_on(y)
    if p.get() == 1 and res1.get() == 10 and res2 == 100:
        print("- Complex Test Python PSCOs: OK")
        return True
    else:
        print("- Complex Test Python PSCOs: ERROR")
        return False
예제 #3
0
파일: pscos.py 프로젝트: giulange/compss
def complex_task(p):
    v = p.get()
    print("P: ", p)
    print("P.get: ", v)
    q = MySO(v * 10)
    q.makePersistent()
    print("Q: ", q)
    print("Q.get = ", q.get())
    return q
예제 #4
0
파일: pscos.py 프로젝트: giulange/compss
def basic_test():
    # type: () -> bool
    """ Basic test

    This Test:
        - Instantiates a SCO.
        - Makes it persistent.
        - Calls a task with that PSCO -> IN parameter.
        - Waits for the task result.
        - Deletes the PSCO.

    :return: True if success. False otherwise.
    """
    o = MySO(10)
    print("BEFORE MAKEPERSISTENT: o.id: ", o.getID())
    # Persist the object to disk (it will be at /tmp/uuid.PSCO)
    o.makePersistent()
    print("AFTER MAKEPERSISTENT:  o.id: ", o.getID())
    v = simple_task(o)
    v1 = compss_wait_on(v)
    # Remove the persisted object from disk (from /tmp/uuid.PSCO)
    o.deletePersistent()
    if v1 == 100:
        print("- Simple Test Python PSCOs: OK")
        return True
    else:
        print("- Simple Test Python PSCOs: ERROR")
        return False
예제 #5
0
파일: pscos.py 프로젝트: giulange/compss
def evaluate_make_persistent_in_task():
    # type: () -> bool
    """ This Test checks what happens when a not persisted persistent object
    is passed an INOUT task parameter and made persistent within the task.

    :return: True if success. False otherwise.
    """
    o = MySO(10)
    make_persistent_in_task_as_parameter(o)
    v = compss_wait_on(o)
    o.deletePersistent()
    if v.get() == 27:
        print("- Persistence of PSCOS in task as INOUT parameter: OK")
        return True
    else:
        print("- Persistence of PSCOS in task as INOUT parameter: ERROR")
        return False
예제 #6
0
파일: pscos.py 프로젝트: giulange/compss
def evaluate_make_persistent_in_task2():
    # type: () -> bool
    """ This Test checks what happens when a not persisted persistent object
    is passed as IN task parameter, made persistent within the task, and
    returned.

    :return: True if success. False otherwise.
    """
    o = MySO(10)
    sco = make_persistent_in_task_as_return(o)
    v = compss_wait_on(sco)
    v.deletePersistent()
    if v.get() == 37:
        print("- Persistence of PSCOS in task as return: OK")
        return True
    else:
        print("- Persistence of PSCOS in task as return: ERROR")
        return False