Python wrapper for running instances of trisurf-ng
Samo Penic
2017-01-07 d50227ea034dae0fb6ee75a9a3941f786facaf16
commit | author | age
8ab985 1 #!/usr/bin/python3
SP 2 from trisurf import trisurf
3 from trisurf import tsmgr
4
5
6
7
8 #Ok... Configure your keys:
9 #ssh-keygen
10 #and copy them to all the remote hosts
11 #ssh-copy-id -i ./ssh/id_rsa.pub username@remotehost
12
13 run2=trisurf.Runner(tape='tape')
14 run2.setMaindir(("N","k","V","Np","Nm"),("nshell","xk0","constvolswitch","npoly","nmono"))
15 run2.setSubdir("run1")
16
17 run3=trisurf.Runner(tape='tape')
18 run3.setMaindir(("N","k","V","Np","Nm"),("nshell","xk0","constvolswitch","npoly","nmono"))
19 run3.setSubdir("run2")
20
21
22 Runs=[run2, run3]
23
f0131d 24 #this is how analyses are defined
SP 25 def analyze(run, **kwargs):
26     host=kwargs.get('host', None)
1c8250 27     print("Demo analysis")
f0131d 28     print("Analysis on host "+host['name']+" for run "+run.Dir.fullpath()+" completed")
1c8250 29     print("here comes info on the run variable:")
SP 30     print(run)
31     print("here comes info on the host variable:")
32     print(host)
33     print("here comes info on the hosts variable:")
34     print(kwargs.get('hosts',None))
35     print("here comes info on the args variable:")
36     print(kwargs.get('args',None))
f0131d 37
d50227 38 def testWebAnalysis(run, **kwargs):
SP 39     print("Simulations are located in "+run.Dir.fullpath())
40     print("\n\nStatistics file:")
41     print(run.Statistics.readText())
f0131d 42
d7e21a 43 hosts=({'name':'natalie','address':'kabinet.penic.eu', 'runs':Runs, 'username':'samo', 'remotebasepath':'simulations-test/subdir/subdir'},
f0131d 44     {'name':'Hestia','address':'127.0.0.1', 'runs':Runs, 'username':'samo'})
d50227 45 analyses={'analysis1':analyze,'webReport':testWebAnalysis}
d7e21a 46
f0131d 47 tsmgr.start(hosts, analyses=analyses)