Python wrapper for running instances of trisurf-ng
Samo Penic
2019-08-15 d5ddc0a56d9f52f27fb6edcc2fa1caf66fdb9eb0
commit | author | age
8ab985 1 #!/usr/bin/python3
SP 2 from trisurf import trisurf
3 from trisurf import tsmgr
4
c1504d 5 from trisurf.analyses import analysis
8ab985 6
SP 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
c1504d 25 @analysis('analyze')
f0131d 26 def analyze(run, **kwargs):
SP 27     host=kwargs.get('host', None)
1c8250 28     print("Demo analysis")
f0131d 29     print("Analysis on host "+host['name']+" for run "+run.Dir.fullpath()+" completed")
1c8250 30     print("here comes info on the run variable:")
SP 31     print(run)
32     print("here comes info on the host variable:")
33     print(host)
34     print("here comes info on the hosts variable:")
35     print(kwargs.get('hosts',None))
36     print("here comes info on the args variable:")
37     print(kwargs.get('args',None))
f0131d 38
d50227 39 def testWebAnalysis(run, **kwargs):
SP 40     print("Simulations are located in "+run.Dir.fullpath())
41     print("\n\nStatistics file:")
42     print(run.Statistics.readText())
f0131d 43
c1504d 44 hosts=({'name':'altea','address':'localhost', 'runs':Runs, 'username':'samo', 'remotebasepath':'simulations-test/subdir/subdir'},)
SP 45 #hosts=({'name':'natalie','address':'kabinet.penic.eu', 'runs':Runs, 'username':'samo', 'remotebasepath':'simulations-test/subdir/subdir'},
46 #    {'name':'Hestia','address':'127.0.0.1', 'runs':Runs, 'username':'samo'})
47 #analyses={'analysis1':analyze,'webReport':testWebAnalysis,'runningavg':analyses.plotrunningavginteractive}
d7e21a 48
c1504d 49
SP 50 print(trisurf._analysis_list)
51 tsmgr.start(hosts)