In [ ]:
import pycompss.interactive as ipycompss
In [ ]:
ipycompss.start(graph=True, trace=True, debug=True, project_xml='../project.xml', resources_xml='../resources.xml')
In [ ]:
from pycompss.api.task import task
In [ ]:
@task(returns=int)
def test(val1):
return val1 * val1
In [ ]:
@task(returns=int)
def test2(val2, val3):
return val2 + val3
In [ ]:
a = test(2)
In [ ]:
b = test2(a, 5)
In [ ]:
from pycompss.api.api import compss_wait_on
In [ ]:
result = compss_wait_on(b)
In [ ]:
print "Results: "
print "a: ", a
print "b: ", b
print "result: ", result
In [ ]:
ipycompss.stop(sync=True)
In [ ]:
print "Results after stopping PyCOMPSs: "
print "a: ", a
print "b: ", b
print "result: ", result
In [ ]:
from pycompss.runtime.binding import Future
if a == 4 and isinstance(b, Future) and result == 9:
print "RESULT=EXPECTED"
else:
print "RESULT=UNEXPECTED"
In [ ]: