In [1]:
import noworkflow.now.ipython as nip
nip.init(path='/home/joao/projects/tapp15')
nip.set_default('graph.width', 392)
In [2]:
nip.Trial(1, graph_height=350, graph_mode=2)
Out[2]:
{"max_duration": {"1": 418302}, "nodes": [{"node": {"count": 1, "info": "Trial 1\u003cbr\u003eFunction \u003cb\u003e/home/joao/projects/tapp15/script1.py\u003c/b\u003e called at line 126\u003cbr/\u003eTotal duration: 418302 microseconds for 1 activations\u003cbr/\u003eMean: 418302.0 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #1 from 2015-06-25 23:26:57.247755 to 2015-06-25 23:26:57.666057 (418302 microseconds)\u003cbr/\u003eReturned None", "level": 0, "trial_id": 1, "duration": 418302, "line": 126, "mean": 418302.0}, "index": 0, "name": "/home/joao/projects/tapp15/script1.py", "caller_id": null, "repr": "C(S(126-/home/joao/projects/tapp15/script1.py), G([C(S(11-x), S(7-z))-1-\u003eS(12-z)], [C(S(11-x), S(7-z))-1-\u003eC(S(11-x), G([S(5-z)-1-\u003eS(6-y)]))], [C(S(11-x), G([S(5-z)-1-\u003eS(6-y)]))-1-\u003eC(S(11-x), S(7-z))], [S(10-range)-1-\u003eC(S(11-x), S(7-z))]))"}, {"node": {"count": 1, "info": "Trial 1\u003cbr\u003eFunction \u003cb\u003ez\u003c/b\u003e called at line 12\u003cbr/\u003eTotal duration: 102114 microseconds for 1 activations\u003cbr/\u003eMean: 102114.0 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #10 from 2015-06-25 23:26:57.563566 to 2015-06-25 23:26:57.665680 (102114 microseconds)\u003cbr/\u003eArguments: i=2\u003cbr/\u003eReturned None", "level": 1, "trial_id": 1, "duration": 102114, "line": 12, "mean": 102114.0}, "index": 1, "name": "z", "repr": "S(12-z)", "caller_id": 1, "duration": 102114}, {"node": {"count": 2, "info": "Trial 1\u003cbr\u003eFunction \u003cb\u003ex\u003c/b\u003e called at line 11\u003cbr/\u003eTotal duration: 202713 microseconds for 2 activations\u003cbr/\u003eMean: 101356.5 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #3 from 2015-06-25 23:26:57.247854 to 2015-06-25 23:26:57.348623 (100769 microseconds)\u003cbr/\u003eArguments: i=0\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #8 from 2015-06-25 23:26:57.461544 to 2015-06-25 23:26:57.563488 (101944 microseconds)\u003cbr/\u003eArguments: i=2\u003cbr/\u003eReturned None", "level": 1, "trial_id": 1, "duration": 202713, "line": 11, "mean": 101356.5}, "index": 2, "name": "x", "repr": "C(S(11-x), S(7-z))", "caller_id": 1, "duration": 202713}, {"node": {"count": 2, "info": "Trial 1\u003cbr\u003eFunction \u003cb\u003ez\u003c/b\u003e called at line 7\u003cbr/\u003eTotal duration: 201862 microseconds for 2 activations\u003cbr/\u003eMean: 100931.0 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #4 from 2015-06-25 23:26:57.247882 to 2015-06-25 23:26:57.348384 (100502 microseconds)\u003cbr/\u003eArguments: i=0\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #9 from 2015-06-25 23:26:57.461593 to 2015-06-25 23:26:57.562953 (101360 microseconds)\u003cbr/\u003eArguments: i=2\u003cbr/\u003eReturned None", "level": 2, "trial_id": 1, "duration": 201862, "line": 7, "mean": 100931.0}, "index": 3, "name": "z", "caller_id": 8, "repr": "S(7-z)"}, {"node": {"count": 1, "info": "Trial 1\u003cbr\u003eFunction \u003cb\u003ex\u003c/b\u003e called at line 11\u003cbr/\u003eTotal duration: 112808 microseconds for 1 activations\u003cbr/\u003eMean: 112808.0 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #5 from 2015-06-25 23:26:57.348663 to 2015-06-25 23:26:57.461471 (112808 microseconds)\u003cbr/\u003eArguments: i=1\u003cbr/\u003eReturned None", "level": 1, "trial_id": 1, "duration": 112808, "line": 11, "mean": 112808.0}, "index": 4, "name": "x", "repr": "C(S(11-x), G([S(5-z)-1-\u003eS(6-y)]))", "caller_id": 1, "duration": 112808}, {"node": {"count": 1, "info": "Trial 1\u003cbr\u003eFunction \u003cb\u003ey\u003c/b\u003e called at line 6\u003cbr/\u003eTotal duration: 10715 microseconds for 1 activations\u003cbr/\u003eMean: 10715.0 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #7 from 2015-06-25 23:26:57.450508 to 2015-06-25 23:26:57.461223 (10715 microseconds)\u003cbr/\u003eArguments: i=1\u003cbr/\u003eReturned None", "level": 2, "trial_id": 1, "duration": 10715, "line": 6, "mean": 10715.0}, "index": 5, "name": "y", "repr": "S(6-y)", "caller_id": 5, "duration": 10715}, {"node": {"count": 1, "info": "Trial 1\u003cbr\u003eFunction \u003cb\u003ez\u003c/b\u003e called at line 5\u003cbr/\u003eTotal duration: 101390 microseconds for 1 activations\u003cbr/\u003eMean: 101390.0 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #6 from 2015-06-25 23:26:57.348683 to 2015-06-25 23:26:57.450073 (101390 microseconds)\u003cbr/\u003eArguments: i=1\u003cbr/\u003eReturned None", "level": 2, "trial_id": 1, "duration": 101390, "line": 5, "mean": 101390.0}, "index": 6, "name": "z", "repr": "S(5-z)", "caller_id": 5, "duration": 101390}, {"node": {"count": 1, "info": "Trial 1\u003cbr\u003eFunction \u003cb\u003erange\u003c/b\u003e called at line 10\u003cbr/\u003eTotal duration: 13 microseconds for 1 activations\u003cbr/\u003eMean: 13.0 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #2 from 2015-06-25 23:26:57.247820 to 2015-06-25 23:26:57.247833 (13 microseconds)\u003cbr/\u003eReturned None", "level": 1, "trial_id": 1, "duration": 13, "line": 10, "mean": 13.0}, "index": 7, "name": "range", "repr": "S(10-range)", "caller_id": 1, "duration": 13}], "edges": [{"count": 1, "source": 0, "type": "initial", "target": 0}, {"count": "", "source": 2, "type": "call", "target": 3}, {"count": "", "source": 3, "type": "return", "target": 2}, {"count": "", "source": 4, "type": "call", "target": 6}, {"count": "", "source": 5, "type": "return", "target": 4}, {"count": 1, "source": 6, "type": "sequence", "target": 5}, {"count": "", "source": 0, "type": "call", "target": 7}, {"count": "", "source": 1, "type": "return", "target": 0}, {"count": 1, "source": 2, "type": "sequence", "target": 1}, {"count": 1, "source": 2, "type": "sequence", "target": 4}, {"count": 1, "source": 4, "type": "sequence", "target": 2}, {"count": 1, "source": 7, "type": "sequence", "target": 2}], "min_duration": {"1": 13}}
In [3]:
trial = _
print(trial.script_content)
from script2 import y, z
def x(i):
if i % 2:
z(i)
return y(i)
return z(i)
if __name__ == '__main__':
for i in range(3):
x(i)
z(i)
In [4]:
%%now_prolog --result result 1
duration({trial.id}, z, X)
In [5]:
for match in result:
print(match['X'])
0.10050201416
0.101389884949
0.101360082626
0.102113962173
In [6]:
%%now_sql
SELECT A.id, A.name, A.trial_id
FROM file_Access F
JOIN function_activation A
ON A.id == function_activation_id
WHERE F.name == "y.txt"
Out[6]:
id name trial_id 7 y 1 17 y 2 27 y 3
In [ ]:
Content source: gems-uff/noworkflow
Similar notebooks: