forked from CVL-dev/cvl-fabric-launcher
-
Notifications
You must be signed in to change notification settings - Fork 6
/
make_default_flavours.py
1771 lines (1524 loc) · 117 KB
/
make_default_flavours.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import re
import siteConfig
import sys
import collections
class sshKeyDistDisplayStringsNCI(siteConfig.sshKeyDistDisplayStrings):
def __init__(self):
super(sshKeyDistDisplayStringsNCI, self).__init__()
self.passwdPrompt="""Please enter the password for your NCI account."""
self.passwdPromptIncorrect="Sorry, that password was incorrect.\n"+self.passwdPrompt
self.passphrasePrompt="Please enter the passphrase for your SSH key"
self.passphrasePromptIncorrect="""Sorry, that passphrase was incorrect.
Please enter the passphrase for you SSH Key
If you have forgoten the passphrase for you key, you may need to delete it and create a new key.
You can find this option under the Identity menu.
"""
self.newPassphrase="""It looks like this is the first time you're using Strudel on this
computer. To use ssh key authentication, Strudel will generate a local
passphrase protected key on your computer which is used to
authenticate you to the NCI computers.
Please enter a new passphrase (twice to avoid typos) to protect your local key.
After you've done this, your passphrase will be the primary method of
authentication for the launcher."""
self.newPassphraseEmptyForbidden="Sorry, empty passphrases are forbidden.\n"+self.newPassphrase
self.createNewKeyDialogNewPassphraseEmptyForbidden="Sorry, empty passphrases are forbidden."
self.newPassphraseTooShort="Sorry, the passphrase must be at least six characters.\n"+self.newPassphrase
self.createNewKeyDialogNewPassphraseTooShort="Passphrase is too short."
self.newPassphraseMismatch="Sorry, the two passphrases you entered don't match.\n"+self.newPassphrase
self.createNewKeyDialogNewPassphraseMismatch="Passphrases don't match!"
self.newPassphraseTitle="Please enter a new passphrase"
self.persistentMessage="Would you like to leave your current session running so that you can reconnect later?"
self.reconnectMessage="An Existing Desktop was found. Would you like to reconnect or kill it and start a new desktop?"
class sshKeyDistDisplayStringsCVL(siteConfig.sshKeyDistDisplayStrings):
def __init__(self):
super(sshKeyDistDisplayStringsCVL, self).__init__()
self.passwdPrompt="""Please enter the password for your CVL account.
This is the password you entered when you requested an account
at the website https://m2-web.massive.org.au/users"""
self.passwdPromptIncorrect="Sorry, that password was incorrect.\n"+self.passwdPrompt
self.passphrasePrompt="Please enter the passphrase for your SSH key"
self.passphrasePromptIncorrect="""Sorry, that passphrase was incorrect.
Please enter the passphrase for you SSH Key
If you have forgoten the passphrase for you key, you may need to delete it and create a new key.
You can find this option under the Identity menu.
"""
self.newPassphrase="""It looks like this is the first time you're using the CVL on this
computer. To use the CVL, the launcher will generate a local
passphrase protected key on your computer which is used to
authenticate you and set up your remote CVL environment.
Please enter a new passphrase (twice to avoid typos) to protect your local key.
After you've done this, your passphrase will be the primary method of
authentication for the launcher.
WHY?
This new method of authentication allows you to create file system
mounts to remote computer systems, and in the future it will support
launching remote HPC jobs."""
self.newPassphraseEmptyForbidden="Sorry, empty passphrases are forbidden.\n"+self.newPassphrase
self.createNewKeyDialogNewPassphraseEmptyForbidden="Sorry, empty passphrases are forbidden."
self.newPassphraseTooShort="Sorry, the passphrase must be at least six characters.\n"+self.newPassphrase
self.createNewKeyDialogNewPassphraseTooShort="Passphrase is too short."
self.newPassphraseMismatch="Sorry, the two passphrases you entered don't match.\n"+self.newPassphrase
self.createNewKeyDialogNewPassphraseMismatch="Passphrases don't match!"
self.newPassphraseTitle="Please enter a new passphrase"
self.persistentMessage="Would you like to leave your current session running so that you can reconnect later?"
self.reconnectMessage="An Existing Desktop was found. Would you like to reconnect or kill it and start a new desktop?"
class sshKeyDistDisplayStringsMASSIVE(siteConfig.sshKeyDistDisplayStrings):
def __init__(self):
super(sshKeyDistDisplayStringsMASSIVE, self).__init__()
self.passwdPrompt="""Please enter the password for your MASSIVE account."""
self.passwdPromptIncorrect="Sorry, that password was incorrect.\n"+self.passwdPrompt
self.passphrasePrompt="Please enter the passphrase for your SSH key"
self.passphrasePromptIncorrect="""
Sorry, that passphrase was incorrect.
Please enter the passphrase for you SSH Key
If you have forgoten the passphrase for you key, you may need to delete it and create a new key.
You can find this option under the Identity menu.
"""
self.newPassphrase="""It looks like this is the first time you're logging in to MASSIVE with this version of the launcher.
To make logging in faster and more secure, the launcher will generate a local
passphrase protected key on your computer which is used to
authenticate you and set up your MASSIVE desktop.
Please enter a new passphrase (twice to avoid typos) to protect your local key.
After you've done this, your passphrase will be the primary method of
authentication for the launcher."""
self.newPassphraseEmptyForbidden="Sorry, empty passphrases are forbidden.\n"+self.newPassphrase
self.createNewKeyDialogNewPassphraseEmptyForbidden="Sorry, empty passphrases are forbidden."
self.newPassphraseTooShort="Sorry, the passphrase must be at least 6 characters.\n"+self.newPassphrase
self.createNewKeyDialogNewPassphraseTooShort="Passphrase is too short."
self.newPassphraseMismatch="Sorry, the two passphrases you entered don't match.\n"+self.newPassphrase
self.createNewKeyDialogNewPassphraseMismatch="Passphrases don't match!"
self.newPassphraseTitle="Please enter a new passphrase"
class sshKeyDistDisplayStringsCQU(siteConfig.sshKeyDistDisplayStrings):
def __init__(self):
super(sshKeyDistDisplayStringsCQU, self).__init__()
self.passwdPrompt="""Please enter the password for your CQU account."""
self.passwdPromptIncorrect="Sorry, that password was incorrect.\n"+self.passwdPrompt
self.persistentMessage="Would you like to leave your current session running so that you can reconnect later?"
self.reconnectMessage="An Existing Desktop was found. Would you like to reconnect or kill it and start a new desktop?"
class sshKeyDistDisplayStringsBMRI(siteConfig.sshKeyDistDisplayStrings):
def __init__(self):
super(sshKeyDistDisplayStringsBMRI, self).__init__()
self.passwdPrompt="""Please enter the password for your BMRI account."""
self.passwdPromptIncorrect="Sorry, that password was incorrect.\n"+self.passwdPrompt
self.persistentMessage="Would you like to leave your current session running so that you can reconnect later?"
self.reconnectMessage="An Existing Desktop was found. Would you like to reconnect or kill it and start a new desktop?"
def getMassiveSiteConfig(loginHost):
massivevisible={}
massivevisible['usernamePanel']=True
massivevisible['projectPanel']=True
massivevisible['resourcePanel']=True
massivevisible['resolutionPanel']='Advanced'
massivevisible['cipherPanel']='Advanced'
massivevisible['debugCheckBoxPanel']='Advanced'
massivevisible['advancedCheckBoxPanel']=True
massivevisible['label_hours']=True
massivevisible['jobParams_hours']=True
massivevisible['label_nodes']=True
massivevisible['jobParams_nodes']=True
c = siteConfig.siteConfig()
c.defaults['jobParams_ppn']=12
c.defaults['jobParams_nodes']=1
c.defaults['jobParams_hours']=4
c.defaults['jobParams_mem']=48
c.visibility=massivevisible
displayStrings=sshKeyDistDisplayStringsMASSIVE()
c.displayStrings.__dict__.update(displayStrings.__dict__)
c.messageRegexs=[re.compile("^INFO:(?P<info>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^WARN:(?P<warn>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^ERROR:(?P<error>.*(?:\n|\r\n?))",re.MULTILINE)]
c.loginHost=loginHost
cmd = '\"module load xmlstarlet ; qstat -x | xml sel -t -m \\"/Data/Job[starts-with(Job_Owner/text(),\'{username}@\') and starts-with(Job_Name/text(),\'desktop\') and job_state/text()!=\'C\']\\" -v \\" concat(./Job_Id/text(),\' \',./Walltime/Remaining/text()) \\" -n - 2>/dev/null\"'
regex='(?P<jobid>(?P<jobidNumber>[0-9]+).\S+) (?P<remainingWalltime>.*)$'
c.listAll=siteConfig.cmdRegEx(cmd,regex,requireMatch=False)
cmd='\"module load pbs ; module load maui ; qstat -f {jobidNumber} -x\"'
regex='.*<job_state>R</job_state>.*'
c.running = siteConfig.cmdRegEx(cmd,regex)
c.stop=siteConfig.cmdRegEx('\'qdel -a {jobidNumber}\'')
c.stopForRestart=siteConfig.cmdRegEx('qdel {jobidNumber} ; sleep 5\'')
cmd='\"module load xmlstarlet ; qstat -x -f {jobid} | xml sel -t -m \\"/Data/Job/exec_host/text()\\" -c \\".\\" -n - | cut -f 1 -d \\"/\\"\"'
regex='(?P<execHost>\S+)'
c.execHost=siteConfig.cmdRegEx(cmd,regex)
c.startServer=siteConfig.cmdRegEx("\'/usr/local/desktop/request_visnode.sh {project} {hours} {nodes} True False False {resolution}\'","^(?P<jobid>(?P<jobidNumber>[0-9]+)\.\S+)\s*$")
c.runSanityCheck=siteConfig.cmdRegEx("\'/usr/local/desktop/sanity_check.sh {launcher_version_number}\'")
#c.getProjects=siteConfig.cmdRegEx('\"glsproject -A -q | grep \',{username},\|\s{username},\|,{username}\s\|\s{username}\s\' \"','^(?P<group>\S+)\s+.*$')
c.getProjects=siteConfig.cmdRegEx('\"/usr/local/bin/glsproject_timeout -A -q | grep -P \'[,\s]{username}[,\s]\' \"','^(?P<group>\S+)\s+.*$')
c.showStart=siteConfig.cmdRegEx("showstart {jobid}","Estimated Rsv based start .*?on (?P<estimatedStart>.*)")
c.vncDisplay= siteConfig.cmdRegEx('"/usr/bin/ssh {execHost} \' module load turbovnc ; vncserver -list\'"','^(?P<vncDisplay>:[0-9]+)\s*(?P<vncPID>[0-9]+)\s*$')
c.otp= siteConfig.cmdRegEx('"/usr/bin/ssh {execHost} \' module load turbovnc ; vncpasswd -o -display localhost{vncDisplay}\'"','^\s*Full control one-time password: (?P<vncPasswd>[0-9]+)\s*$')
c.agent=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=yes -l {username} {loginHost} \"/usr/bin/ssh -A {execHost} \\"echo agent_hello; bash \\"\"','agent_hello',async=True)
c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=yes -L {localPortNumber}:{execHost}:{remotePortNumber} -l {username} {loginHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
cmd='"echo DBUS_SESSION_BUS_ADDRESS=dummy_dbus_session_bus_address"'
regex='^DBUS_SESSION_BUS_ADDRESS=(?P<dbusSessionBusAddress>.*)$'
c.dbusSessionBusAddress=siteConfig.cmdRegEx(cmd,regex)
cmd='\"/usr/local/desktop/get_ephemeral_port.py\"'
regex='^(?P<intermediateWebDavPortNumber>[0-9]+)$'
c.webDavIntermediatePort=siteConfig.cmdRegEx(cmd,regex)
cmd='\"/usr/bin/ssh {execHost} /usr/local/desktop/get_ephemeral_port.py\"'
regex='^(?P<remoteWebDavPortNumber>[0-9]+)$'
c.webDavRemotePort=siteConfig.cmdRegEx(cmd,regex)
cmd='echo Mounting WebDAV...' # For CentOS 5 / KDE, we are not really "mounting", just displaying the WebDAV share in Konqueror.
c.webDavMount=siteConfig.cmdRegEx(cmd)
cmd='"/usr/bin/ssh {execHost} \'DISPLAY={vncDisplay} /usr/bin/konqueror webdav://{localUsername}:{vncPasswd}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\'"'
c.openWebDavShareInRemoteFileBrowser=siteConfig.cmdRegEx(cmd)
# The Window ID is not needed for MASSIVE. We use the server-side script: /usr/local/desktop/close_webdav_window.sh which figures out which window to close.
cmd='"echo DummyWebDavWindowID=-1"'
regex='^DummyWebDavWindowID=(?P<webDavWindowID>.*)$'
c.webDavWindowID=siteConfig.cmdRegEx(cmd,regex)
cmd='"/usr/bin/ssh {execHost} \'echo -e \\"You can access your local home directory in Konqueror with the URL:%sbr%s\\nwebdav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}%sbr%s\\nYour one-time password is {vncPasswd}\\" > ~/.vnc/\\$(hostname){vncDisplay}-webdav.txt;\'"'
c.displayWebDavInfoDialogOnRemoteDesktop = siteConfig.cmdRegEx(cmd)
# Chris trying to avoid using the intermediate port:
#cmd='{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -oExitOnForwardFailure=yes -R {execHost}:{remoteWebDavPortNumber}:localhost:{localWebDavPortNumber} -l {username} {loginHost} "echo tunnel_hello; bash"'
cmd='{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -oExitOnForwardFailure=yes -R {intermediateWebDavPortNumber}:localhost:{localWebDavPortNumber} -l {username} {loginHost} "ssh -R {remoteWebDavPortNumber}:localhost:{intermediateWebDavPortNumber} {execHost} \'echo tunnel_hello; bash\'"'
regex='tunnel_hello'
c.webDavTunnel=siteConfig.cmdRegEx(cmd,regex,async=True)
cmd = 'echo hello'
regex = 'hello'
c.webDavUnmount=siteConfig.cmdRegEx(cmd,regex)
cmd = '"/usr/bin/ssh {execHost} \'DISPLAY={vncDisplay} /usr/local/desktop/close_webdav_window.sh webdav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\'"'
c.webDavCloseWindow=siteConfig.cmdRegEx(cmd)
return c
def getM3Config(loginHost,flavour=None):
# usage: vis_manager.py [-h]
#
# {showstart,isrunning,vncport,newsession,stop,sanitycheck,getprojects,exechost,listall}
# ...
#
# positional arguments:
# {showstart,isrunning,vncport,newsession,stop,sanitycheck,getprojects,exechost,listall}
# listall lists all the users running vis jobs in the format of
# "sessionid timeleft (seconds)"
# newsession create a new desktop session and return an id or error
# message
# isrunning test if a vis session has started yet (returns "true"
# if it is)
# exechost return information about which node a vis session is
# running on
# vncport return the port on which the vnc server started
# stop stop a running vis session
# getprojects list the available projects for running sessions
# showstart get the estimate of when the vis session will start
# sanitycheck run a simple sanity check e.g. make sure the user has
# enough file system space to create files
#
# optional arguments:
# -h, --help show this help message and exit
massivevisible={}
massivevisible['usernamePanel']=True
massivevisible['projectPanel']=True
massivevisible['resourcePanel']=True
massivevisible['resolutionPanel']='Advanced'
massivevisible['cipherPanel']='Advanced'
massivevisible['debugCheckBoxPanel']='Advanced'
massivevisible['advancedCheckBoxPanel']=True
massivevisible['label_hours']=True
massivevisible['jobParams_hours']=True
massivevisible['label_nodes']=True
massivevisible['jobParams_nodes']=True
c = siteConfig.siteConfig()
c.defaults['jobParams_ppn']=12
c.defaults['jobParams_nodes']=1
c.defaults['jobParams_hours']=4
c.defaults['jobParams_mem']=48
c.visibility=massivevisible
displayStrings=sshKeyDistDisplayStringsMASSIVE()
c.displayStrings.__dict__.update(displayStrings.__dict__)
c.messageRegexs=[re.compile("^INFO:(?P<info>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^WARN:(?P<warn>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^ERROR:(?P<error>.*(?:\n|\r\n?))",re.MULTILINE)]
c.loginHost=loginHost
cmd = '\"/usr/local/desktop/vis_manager.py listall\"'
regex='(?P<sessionid>[0-9]+) (?P<remainingWalltime>.*)$'
c.listAll=siteConfig.cmdRegEx(cmd,regex,requireMatch=False)
cmd='"/usr/local/desktop/vis_manager.py isrunning -s {sessionid}"'
regex='true'
c.running = siteConfig.cmdRegEx(cmd,regex)
c.stop=siteConfig.cmdRegEx('/usr/local/desktop/vis_manager.py stop -s {sessionid}')
c.stopForRestart=siteConfig.cmdRegEx('/usr/local/desktop/vis_manager.py stop -s {sessionid} --wait 4')
cmd='\"/usr/local/desktop/vis_manager.py exechost -s {sessionid}\"'
regex='(?P<execHost>\S+)'
c.execHost=siteConfig.cmdRegEx(cmd,regex)
if flavour:
c.startServer=siteConfig.cmdRegEx("\'/usr/local/desktop/vis_manager.py newsession -p {project} -t {hours} -n {nodes} -r {resolution} -f %s\'"%flavour,"(?P<sessionid>[0-9]+)")
else:
c.startServer=siteConfig.cmdRegEx("\'/usr/local/desktop/vis_manager.py newsession -p {project} -t {hours} -n {nodes} -r {resolution} \'","(?P<sessionid>[0-9]+)")
c.runSanityCheck=siteConfig.cmdRegEx("\'/usr/local/desktop/vis_manager.py sanitycheck -l {launcher_version_number}\'")
# getprojects list the available projects for running sessions
c.getProjects=siteConfig.cmdRegEx('\"/usr/local/desktop/vis_manager.py getprojects \"','(?P<group>.*)')
# showstart get the estimate of when the vis session will start
# usage: vis_manager.py showstart [-h] -s SESSIONID
# c.showStart=siteConfig.cmdRegEx("showstart {jobid}","Estimated Rsv based start .*?on (?P<estimatedStart>.*)")
c.showStart=siteConfig.cmdRegEx("/usr/local/desktop/vis_manager.py showstart -s {sessionid}","(?P<estimatedStart>.*)")
# vncport return the port on which the vnc server started
# usage: vis_manager.py vncport [-h] -s SESSIONID
c.vncDisplay=siteConfig.cmdRegEx("/usr/local/desktop/vis_manager.py vncport -s {sessionid}",'^(?P<vncDisplay>:[0-9]+)')
c.otp= siteConfig.cmdRegEx('/usr/local/desktop/vis_manager.py getpassword','(?P<vncPasswd>[0-9]+)\s*$')
c.agent=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=yes -l {username} {loginHost} \"/usr/bin/ssh -A {execHost} \\"echo agent_hello; bash \\"\"','agent_hello',async=True)
c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=yes -L {localPortNumber}:{execHost}:{remotePortNumber} -l {username} {loginHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
cmd='"echo DBUS_SESSION_BUS_ADDRESS=dummy_dbus_session_bus_address"'
regex='^DBUS_SESSION_BUS_ADDRESS=(?P<dbusSessionBusAddress>.*)$'
c.dbusSessionBusAddress=siteConfig.cmdRegEx(cmd,regex)
cmd='\"/usr/local/desktop/get_ephemeral_port.py\"'
regex='^(?P<intermediateWebDavPortNumber>[0-9]+)$'
c.webDavIntermediatePort=siteConfig.cmdRegEx(cmd,regex)
cmd='\"/usr/bin/ssh {execHost} /usr/local/desktop/get_ephemeral_port.py\"'
regex='^(?P<remoteWebDavPortNumber>[0-9]+)$'
c.webDavRemotePort=siteConfig.cmdRegEx(cmd,regex)
cmd='echo Mounting WebDAV...' # For CentOS 5 / KDE, we are not really "mounting", just displaying the WebDAV share in Konqueror.
c.webDavMount=siteConfig.cmdRegEx(cmd)
cmd='"/usr/bin/ssh {execHost} \'DISPLAY={vncDisplay} /usr/bin/konqueror webdav://{localUsername}:{vncPasswd}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\'"'
c.openWebDavShareInRemoteFileBrowser=siteConfig.cmdRegEx(cmd)
# The Window ID is not needed for MASSIVE. We use the server-side script: /usr/local/desktop/close_webdav_window.sh which figures out which window to close.
cmd='"echo DummyWebDavWindowID=-1"'
regex='^DummyWebDavWindowID=(?P<webDavWindowID>.*)$'
c.webDavWindowID=siteConfig.cmdRegEx(cmd,regex)
cmd='"/usr/bin/ssh {execHost} \'echo -e \\"You can access your local home directory in Konqueror with the URL:%sbr%s\\nwebdav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}%sbr%s\\nYour one-time password is {vncPasswd}\\" > ~/.vnc/\\$(hostname){vncDisplay}-webdav.txt;\'"'
c.displayWebDavInfoDialogOnRemoteDesktop = siteConfig.cmdRegEx(cmd)
# Chris trying to avoid using the intermediate port:
#cmd='{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -oExitOnForwardFailure=yes -R {execHost}:{remoteWebDavPortNumber}:localhost:{localWebDavPortNumber} -l {username} {loginHost} "echo tunnel_hello; bash"'
cmd='{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -oExitOnForwardFailure=yes -R {intermediateWebDavPortNumber}:localhost:{localWebDavPortNumber} -l {username} {loginHost} "ssh -R {remoteWebDavPortNumber}:localhost:{intermediateWebDavPortNumber} {execHost} \'echo tunnel_hello; bash\'"'
regex='tunnel_hello'
c.webDavTunnel=siteConfig.cmdRegEx(cmd,regex,async=True)
cmd = 'echo hello'
regex = 'hello'
c.webDavUnmount=siteConfig.cmdRegEx(cmd,regex)
cmd = '"/usr/bin/ssh {execHost} \'DISPLAY={vncDisplay} /usr/local/desktop/close_webdav_window.sh webdav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\'"'
c.webDavCloseWindow=siteConfig.cmdRegEx(cmd)
return c
def getRaijinSiteConfig(queue):
c = getCVLSiteConfig(queue)
s = sshKeyDistDisplayStringsNCI()
c.displayStrings.__dict__.update(s.__dict__)
c.visibility['resourcePanel']=True
c.visibility['ppnLabel']=False
c.visibility['jobParams_ppn']=False
c.visibility['ssh_key_mode_panel']='Advanced'
c.visibility['copyid_mode_panel']=False
c.loginHost='raijin.nci.org.au'
c.directConnect=False
cmd='\"module load pbs ; qstat -f {jobidNumber} \"'
regex='.*job_state = R.*'
c.running=siteConfig.cmdRegEx(cmd,regex)
c.stop=siteConfig.cmdRegEx('\"module load pbs ; qdel {jobidNumber}\"')
c.stopForRestart=siteConfig.cmdRegEx('\"module load pbs ; qdel {jobidNumber}\"')
c.agent=siteConfig.cmdRegEx()
c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -L {localPortNumber}:{execHost}:{remotePortNumber} -l {username} {loginHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
c.otp= siteConfig.cmdRegEx('\'cat ~/.vnc/passwdfile\'','^(?P<vncPasswd>\S+)$')
cmd='\" mkdir ~/.vnc ; rm -f ~/.vnc/passwdfile ; touch ~/.vnc/passwdfile ; chmod 600 ~/.vnc/passwdfile ; passwd=\"\'$\'\"( dd if=/dev/urandom bs=1 count=8 2>/dev/null | md5sum | cut -b 1-8 ) ; echo \"\'$\'\"passwd > ~/.vnc/passwdfile ; echo \\\" module load x11vnc ; x11vnc -usepw -create -shared -forever\\\" | qsub -q %s -l ncpus={nodes} -N desktop_{username} -l walltime={hours}:00 -o .vnc/ -e .vnc/ \"'%queue
regex="^(?P<jobid>(?P<jobidNumber>[0-9]+)\.\S+)\s*$"
c.startServer=siteConfig.cmdRegEx(cmd,regex)
c.vncDisplay=siteConfig.cmdRegEx('\'qcat {jobidNumber}\'','PORT=59(?P<vncDisplay>[0-9]+)')
cmd='\"module load pbs ; qstat -f {jobidNumber} | grep exec_host\"'
regex='^\s*exec_host = (?P<execHost>r[0-9]+)\/.*$'
c.execHost = siteConfig.cmdRegEx(cmd,regex)
c.listAll=siteConfig.cmdRegEx('\"module load pbs ; qstat -u {username} | tail -n +6\"','^\s*(?P<jobid>(?P<jobidNumber>[0-9]+).\S+)\s+\S+\s+\S+\s+(?P<jobname>desktop_\S+)\s+(?P<sessionID>\S+)\s+(?P<nodes>\S+)\s+(?P<tasks>\S+)\s+(?P<mem>\S+)\s+(?P<reqTime>\S+)\s+(?P<state>[^C])\s+(?P<elapTime>\S+)\s*$',requireMatch=False)
return c
def getMassiveCentos6SiteConfig(loginHost,flavour=None):
# usage: vis_manager.py [-h]
#
# {showstart,isrunning,vncport,newsession,stop,sanitycheck,getprojects,exechost,listall}
# ...
#
# positional arguments:
# {showstart,isrunning,vncport,newsession,stop,sanitycheck,getprojects,exechost,listall}
# listall lists all the users running vis jobs in the format of
# "sessionid timeleft (seconds)"
# newsession create a new desktop session and return an id or error
# message
# isrunning test if a vis session has started yet (returns "true"
# if it is)
# exechost return information about which node a vis session is
# running on
# vncport return the port on which the vnc server started
# stop stop a running vis session
# getprojects list the available projects for running sessions
# showstart get the estimate of when the vis session will start
# sanitycheck run a simple sanity check e.g. make sure the user has
# enough file system space to create files
#
# optional arguments:
# -h, --help show this help message and exit
massivevisible={}
massivevisible['usernamePanel']=True
massivevisible['projectPanel']=True
massivevisible['resourcePanel']=True
massivevisible['resolutionPanel']='Advanced'
massivevisible['cipherPanel']='Advanced'
massivevisible['debugCheckBoxPanel']='Advanced'
massivevisible['advancedCheckBoxPanel']=True
massivevisible['label_hours']=True
massivevisible['jobParams_hours']=True
massivevisible['label_nodes']=True
massivevisible['jobParams_nodes']=True
c = siteConfig.siteConfig()
c.defaults['jobParams_ppn']=12
c.defaults['jobParams_nodes']=1
c.defaults['jobParams_hours']=4
c.defaults['jobParams_mem']=48
c.visibility=massivevisible
displayStrings=sshKeyDistDisplayStringsMASSIVE()
c.displayStrings.__dict__.update(displayStrings.__dict__)
c.messageRegexs=[re.compile("^INFO:(?P<info>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^WARN:(?P<warn>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^ERROR:(?P<error>.*(?:\n|\r\n?))",re.MULTILINE)]
c.loginHost=loginHost
# listall lists all the users running vis jobs in the format of "sessionid timeleft (seconds)"
# usage: vis_manager.py listall [-h]
# cmd = '\"module load xmlstarlet ; qstat -x | xml sel -t -m \\"/Data/Job[starts-with(Job_Owner/text(),\'{username}@\') and starts-with(Job_Name/text(),\'desktop\') and job_state/text()!=\'C\']\\" -v \\" concat(./Job_Id/text(),\' \',./Walltime/Remaining/text()) \\" -n - 2>/dev/null\"'
cmd = '\"/usr/local/desktop/vis_manager.py listall\"'
# regex='(?P<jobid>(?P<jobidNumber>[0-9]+).\S+) (?P<remainingWalltime>.*)$'
regex='(?P<sessionid>[0-9]+) (?P<remainingWalltime>.*)$'
c.listAll=siteConfig.cmdRegEx(cmd,regex,requireMatch=False)
# isrunning test if a vis session has started yet (returns "true" if it is)
# usage: vis_manager.py isrunning [-h] -s SESSIONID
# cmd='\"module load pbs ; module load maui ; qstat -f {jobidNumber} -x\"'
cmd='"/usr/local/desktop/vis_manager.py isrunning -s {sessionid}"'
# regex='.*<job_state>R</job_state>.*'
regex='true'
c.running = siteConfig.cmdRegEx(cmd,regex)
# stop stop a running vis session
# usage: vis_manager.py stop [-h] -s SESSIONID [-w WAIT]
# c.stop=siteConfig.cmdRegEx('\'qdel -a {jobidNumber}\'')
c.stop=siteConfig.cmdRegEx('/usr/local/desktop/vis_manager.py stop -s {sessionid}')
# c.stopForRestart=siteConfig.cmdRegEx('qdel {jobidNumber} ; sleep 5\'')
c.stopForRestart=siteConfig.cmdRegEx('/usr/local/desktop/vis_manager.py stop -s {sessionid} --wait 4')
# exechost return information about which node a vis session is running on
# usage: vis_manager.py exechost [-h] -s SESSIONID
# cmd='\"module load xmlstarlet ; qstat -x -f {jobid} | xml sel -t -m \\"/Data/Job/exec_host/text()\\" -c \\".\\" -n - | cut -f 1 -d \\"/\\"\"'
cmd='\"/usr/local/desktop/vis_manager.py exechost -s {sessionid}\"'
regex='(?P<execHost>\S+)'
c.execHost=siteConfig.cmdRegEx(cmd,regex)
# newsession create a new desktop session and return an id or error message
# usage: vis_manager.py newsession [-h] -p PROJECT -t HOURS [-f FLAVOUR] [-n NODES] [-r RESOLUTION]
# c.startServer=siteConfig.cmdRegEx("\'/usr/local/desktop/request_visnode.sh {project} {hours} {nodes} True False False {resolution}\'","^(?P<jobid>(?P<jobidNumber>[0-9]+)\.\S+)\s*$")
if flavour:
c.startServer=siteConfig.cmdRegEx("\'/usr/local/desktop/vis_manager.py newsession -p {project} -t {hours} -n {nodes} -r {resolution} -f %s\'"%flavour,"(?P<sessionid>[0-9]+)")
else:
c.startServer=siteConfig.cmdRegEx("\'/usr/local/desktop/vis_manager.py newsession -p {project} -t {hours} -n {nodes} -r {resolution} \'","(?P<sessionid>[0-9]+)")
# sanitycheck run a simple sanity check e.g. make sure the user has enough file system space to create files
# usage: vis_manager.py sanitycheck [-h] -l LAUNCHERVERSION
# c.runSanityCheck=siteConfig.cmdRegEx("\'/usr/local/desktop/sanity_check.sh {launcher_version_number}\'")
c.runSanityCheck=siteConfig.cmdRegEx("\'/usr/local/desktop/vis_manager.py sanitycheck -l {launcher_version_number}\'")
# getprojects list the available projects for running sessions
# usage: vis_manager.py getprojects [-h]
#c.getProjects=siteConfig.cmdRegEx('\"glsproject -A -q | grep \',{username},\|\s{username},\|,{username}\s\|\s{username}\s\' \"','^(?P<group>\S+)\s+.*$')
# older c.getProjects=siteConfig.cmdRegEx('\"/usr/local/bin/glsproject_timeout -A -q | grep -P \'[,\s]{username}[,\s]\' \"','^(?P<group>\S+)\s+.*$')
# old c.getProjects=siteConfig.cmdRegEx('\"/usr/local/bin/glsproject_timeout -A -q | grep -P \'[,\s]{username}[,\s]\' \"','^(?P<group>\S+)\s+.*$')
c.getProjects=siteConfig.cmdRegEx('\"/usr/local/desktop/vis_manager.py getprojects \"','(?P<group>.*)')
# showstart get the estimate of when the vis session will start
# usage: vis_manager.py showstart [-h] -s SESSIONID
# c.showStart=siteConfig.cmdRegEx("showstart {jobid}","Estimated Rsv based start .*?on (?P<estimatedStart>.*)")
c.showStart=siteConfig.cmdRegEx("/usr/local/desktop/vis_manager.py showstart -s {sessionid}","(?P<estimatedStart>.*)")
# vncport return the port on which the vnc server started
# usage: vis_manager.py vncport [-h] -s SESSIONID
c.vncDisplay= siteConfig.cmdRegEx('"/usr/bin/ssh {execHost} \' module load turbovnc ; vncserver -list\'"','^(?P<vncDisplay>:[0-9]+)\s*(?P<vncPID>[0-9]+)\s*$')
c.otp= siteConfig.cmdRegEx('"/usr/bin/ssh {execHost} \' module load turbovnc ; vncpasswd -o -display localhost{vncDisplay}\'"','^\s*Full control one-time password: (?P<vncPasswd>[0-9]+)\s*$')
c.agent=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=yes -l {username} {loginHost} \"/usr/bin/ssh -A {execHost} \\"echo agent_hello; bash \\"\"','agent_hello',async=True)
c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=yes -L {localPortNumber}:{execHost}:{remotePortNumber} -l {username} {loginHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
cmd='"echo DBUS_SESSION_BUS_ADDRESS=dummy_dbus_session_bus_address"'
regex='^DBUS_SESSION_BUS_ADDRESS=(?P<dbusSessionBusAddress>.*)$'
c.dbusSessionBusAddress=siteConfig.cmdRegEx(cmd,regex)
cmd='\"/usr/local/desktop/get_ephemeral_port.py\"'
regex='^(?P<intermediateWebDavPortNumber>[0-9]+)$'
c.webDavIntermediatePort=siteConfig.cmdRegEx(cmd,regex)
cmd='\"/usr/bin/ssh {execHost} /usr/local/desktop/get_ephemeral_port.py\"'
regex='^(?P<remoteWebDavPortNumber>[0-9]+)$'
c.webDavRemotePort=siteConfig.cmdRegEx(cmd,regex)
cmd='echo Mounting WebDAV...' # For CentOS 5 / KDE, we are not really "mounting", just displaying the WebDAV share in Konqueror.
c.webDavMount=siteConfig.cmdRegEx(cmd)
cmd='"/usr/bin/ssh {execHost} \'DISPLAY={vncDisplay} /usr/bin/konqueror webdav://{localUsername}:{vncPasswd}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\'"'
c.openWebDavShareInRemoteFileBrowser=siteConfig.cmdRegEx(cmd)
# The Window ID is not needed for MASSIVE. We use the server-side script: /usr/local/desktop/close_webdav_window.sh which figures out which window to close.
cmd='"echo DummyWebDavWindowID=-1"'
regex='^DummyWebDavWindowID=(?P<webDavWindowID>.*)$'
c.webDavWindowID=siteConfig.cmdRegEx(cmd,regex)
cmd='"/usr/bin/ssh {execHost} \'echo -e \\"You can access your local home directory in Konqueror with the URL:%sbr%s\\nwebdav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}%sbr%s\\nYour one-time password is {vncPasswd}\\" > ~/.vnc/\\$(hostname){vncDisplay}-webdav.txt;\'"'
c.displayWebDavInfoDialogOnRemoteDesktop = siteConfig.cmdRegEx(cmd)
# Chris trying to avoid using the intermediate port:
#cmd='{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -oExitOnForwardFailure=yes -R {execHost}:{remoteWebDavPortNumber}:localhost:{localWebDavPortNumber} -l {username} {loginHost} "echo tunnel_hello; bash"'
cmd='{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -oExitOnForwardFailure=yes -R {intermediateWebDavPortNumber}:localhost:{localWebDavPortNumber} -l {username} {loginHost} "ssh -R {remoteWebDavPortNumber}:localhost:{intermediateWebDavPortNumber} {execHost} \'echo tunnel_hello; bash\'"'
regex='tunnel_hello'
c.webDavTunnel=siteConfig.cmdRegEx(cmd,regex,async=True)
cmd = 'echo hello'
regex = 'hello'
c.webDavUnmount=siteConfig.cmdRegEx(cmd,regex)
cmd = '"/usr/bin/ssh {execHost} \'DISPLAY={vncDisplay} /usr/local/desktop/close_webdav_window.sh webdav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\'"'
c.webDavCloseWindow=siteConfig.cmdRegEx(cmd)
return c
def getRaijinSiteConfig(queue):
c = getCVLSiteConfig(queue)
s = sshKeyDistDisplayStringsNCI()
c.displayStrings.__dict__.update(s.__dict__)
c.visibility['resourcePanel']=True
c.visibility['ppnLabel']=False
c.visibility['jobParams_ppn']=False
c.visibility['ssh_key_mode_panel']='Advanced'
c.visibility['copyid_mode_panel']=False
c.loginHost='raijin.nci.org.au'
c.directConnect=False
cmd='\"module load pbs ; qstat -f {jobidNumber} \"'
regex='.*job_state = R.*'
c.running=siteConfig.cmdRegEx(cmd,regex)
c.stop=siteConfig.cmdRegEx('\"module load pbs ; qdel {jobidNumber}\"')
c.stopForRestart=siteConfig.cmdRegEx('\"module load pbs ; qdel {jobidNumber}\"')
c.agent=siteConfig.cmdRegEx()
c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -L {localPortNumber}:{execHost}:{remotePortNumber} -l {username} {loginHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
c.otp= siteConfig.cmdRegEx('\'cat ~/.vnc/passwdfile\'','^(?P<vncPasswd>\S+)$')
cmd='\" mkdir ~/.vnc ; rm -f ~/.vnc/passwdfile ; touch ~/.vnc/passwdfile ; chmod 600 ~/.vnc/passwdfile ; passwd=\"\'$\'\"( dd if=/dev/urandom bs=1 count=8 2>/dev/null | md5sum | cut -b 1-8 ) ; echo \"\'$\'\"passwd > ~/.vnc/passwdfile ; echo \\\" module load x11vnc ; x11vnc -usepw -create -shared -forever\\\" | qsub -q %s -l ncpus={nodes} -N desktop_{username} -l walltime={hours}:00 -o .vnc/ -e .vnc/ \"'%queue
regex="^(?P<jobid>(?P<jobidNumber>[0-9]+)\.\S+)\s*$"
c.startServer=siteConfig.cmdRegEx(cmd,regex)
c.vncDisplay=siteConfig.cmdRegEx('\'qcat {jobidNumber}\'','PORT=59(?P<vncDisplay>[0-9]+)')
cmd='\"module load pbs ; qstat -f {jobidNumber} | grep exec_host\"'
regex='^\s*exec_host = (?P<execHost>r[0-9]+)\/.*$'
c.execHost = siteConfig.cmdRegEx(cmd,regex)
c.listAll=siteConfig.cmdRegEx('\"module load pbs ; qstat -u {username} | tail -n +6\"','^\s*(?P<jobid>(?P<jobidNumber>[0-9]+).\S+)\s+\S+\s+\S+\s+(?P<jobname>desktop_\S+)\s+(?P<sessionID>\S+)\s+(?P<nodes>\S+)\s+(?P<tasks>\S+)\s+(?P<mem>\S+)\s+(?P<reqTime>\S+)\s+(?P<state>[^C])\s+(?P<elapTime>\S+)\s*$',requireMatch=False)
return c
def getRaijinLoginSiteConfig(loginnode):
c = getCVLSiteConfig(" ")
c.visibility['resourcePanel']=False
c.visibility['ssh_key_mode_panel']='Advanced'
c.visibility['copyid_mode_panel']=False
c.loginHost=loginnode
c.directConnect=False
cmd='\" pid=\"\'$\'\"( cat ~/.vnc/{loginHost}.log | grep pid | rev | cut -f 1 -d \\\" \\\" | rev ) ; ps -p \"\'$\'\"pid -o pid,pgrp,user --no-headers 2>/dev/null\"'
regex='(?P<pid>[0-9]+)\s+(?P<pgrp>[0-9]+)\s+{username}'
c.running=siteConfig.cmdRegEx(cmd,regex)
# For reasons I don't understand Xvfb does not inherit the process group of x11vnc
c.stop=siteConfig.cmdRegEx('\"kill -- -{pgrp} ; pkill -U {username} Xvfb\"')
c.stopForRestart=siteConfig.cmdRegEx('\"kill -- -{pgrp} ; pkill -U {username} Xvfb\"')
c.agent=siteConfig.cmdRegEx()
c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -L {localPortNumber}:localhost:{remotePortNumber} -l {username} {loginHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
c.otp= siteConfig.cmdRegEx('\'cat ~/.vnc/passwdfile\'','^(?P<vncPasswd>\S+)$')
cmd='\" mkdir ~/.vnc 2>/dev/null ; rm -f ~/.vnc/{loginHost}.log ; rm -f ~/.vnc/passwdfile ; touch ~/.vnc/passwdfile ; chmod 600 ~/.vnc/passwdfile ; passwd=\"\'$\'\"( dd if=/dev/urandom bs=1 count=8 2>/dev/null | md5sum | cut -b 1-8 ) ; echo \"\'$\'\"passwd > ~/.vnc/passwdfile ; module load x11vnc ; x11vnc -usepw -create -shared -forever > .vnc/{loginHost}.log 2>{ampersand}1 {ampersand} echo started\"'
c.startServer=siteConfig.cmdRegEx(cmd,"started")
c.vncDisplay=siteConfig.cmdRegEx('\'cat ~/.vnc/{loginHost}.log\'','PORT=59(?P<vncDisplay>[0-9]+)')
c.execHost = siteConfig.cmdRegEx()
c.listAll=siteConfig.cmdRegEx('\"pid=\"\'$\'\"( cat ~/.vnc/{loginHost}.log 2>/dev/null | grep pid | rev | cut -f 1 -d \\\" \\\" | rev ) ; ps -p \"\'$\'\"pid -o pid,pgrp,user --no-headers 2>/dev/null\"','(?P<pid>[0-9]+)\s+(?P<pgrp>[0-9]+)\s+{username}',requireMatch=False)
return c
def getSiteConfigSlurm(loginhost,partition):
cvlvisible={}
cvlvisible['usernamePanel']=True
cvlvisible['resourcePanel']='Advanced'
cvlvisible['resolutionPanel']='Advanced'
cvlvisible['cipherPanel']='Advanced'
cvlvisible['debugCheckBoxPanel']='Advanced'
cvlvisible['advancedCheckBoxPanel']=True
cvlvisible['label_hours']=True
cvlvisible['jobParams_hours']=True
cvlvisible['label_ppn']=True
cvlvisible['jobParams_ppn']=True
cvlvisible['label_nodes']=True
cvlvisible['jobParams_nodes']=True
c = siteConfig.siteConfig()
cvlstrings = sshKeyDistDisplayStringsCVL()
c.displayStrings.__dict__.update(cvlstrings.__dict__)
c.visibility=cvlvisible
c.directConnect=True
c.authURL=None
c.loginHost=loginhost
c.defaults['jobParams_ppn']=1
c.defaults['jobParams_hours']=48
c.defaults['jobParams_mem']=4
cmd = '\"squeue -u {username} -o \\"%i %L\\" | tail -n -1\"'
regex='(?P<jobid>(?P<jobidNumber>[0-9]+)) (?P<remainingWalltime>.*)$'
c.listAll=siteConfig.cmdRegEx(cmd,regex,requireMatch=False)
c.messageRegexs=[re.compile("^INFO:(?P<info>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^WARN:(?P<warn>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^ERROR:(?P<error>.*(?:\n|\r\n?))",re.MULTILINE)]
#cmd='\"squeue -j {jobidNumber} -o "%N" | tail -n -1 | cut -f 1 -d \',\' | xargs -iname getent hosts name | cut -f 1 -d \' \' \"'
cmd='\"scontrol show job {jobidNumber} | grep BatchHost | cut -f 2 -d \'=\' | xargs -iname getent hosts name | cut -f 1 -d \' \' \"'
regex='^(?P<execHost>.*)$'
c.execHost = siteConfig.cmdRegEx(cmd,regex)
cmd='\"groups | sed \'s@ @\\n@g\'\"' # '\'groups | sed \'s\/\\\\ \/\\\\\\\\n\/g\'\''
regex='^\s*(?P<group>\S+)\s*$'
c.getProjects = siteConfig.cmdRegEx(cmd,regex)
cmd='\"scontrol show job {jobidNumber}\"'
regex='JobState=RUNNING'
c.running=siteConfig.cmdRegEx(cmd,regex)
cmd="\"mkdir ~/.vnc ; rm -f ~/.vnc/clearpass ; touch ~/.vnc/clearpass ; chmod 600 ~/.vnc/clearpass ; passwd=\"\'$\'\"( dd if=/dev/urandom bs=1 count=8 2>/dev/null | md5sum | cut -b 1-8 ) ; echo \"\'$\'\"passwd > ~/.vnc/clearpass ; module load turbovnc ; cat ~/.vnc/clearpass | vncpasswd -f > ~/.vnc/passwd ; chmod 600 ~/.vnc/passwd ; export PATH=\"\'$\'\"PATH:/bin ; echo -e \'#!/bin/bash\\n vncserver -geometry {resolution} ; sleep 36000 \' | sbatch -p %s -N {nodes} --mincpus {ppn} --time={hours}:00:00 -J desktop_{username} -o .vnc/slurm-%%j.out \""%partition
# cmd="\" echo -e \'#!/bin/bash\\n/usr/local/bin/vncsession --vnc turbovnc --geometry {resolution} ; sleep 36000000 \' | sbatch -p %s -N {nodes} --mincpus {ppn} --time={hours}:00:00 -J desktop_{username} -o .vnc/slurm-%%j.out \""%partition
regex="^Submitted batch job (?P<jobid>(?P<jobidNumber>[0-9]+))$"
c.startServer=siteConfig.cmdRegEx(cmd,regex)
c.stop=siteConfig.cmdRegEx('\"scancel {jobidNumber}\"')
c.stopForRestart=siteConfig.cmdRegEx('\"scancel {jobidNumber}\"')
#c.vncDisplay= siteConfig.cmdRegEx('\"cat .vnc/slurm-{jobidNumber}.out\"' ,'^.*?started on display \S+(?P<vncDisplay>:[0-9]+)\s*$')
c.vncDisplay= siteConfig.cmdRegEx('\"cat .vnc/slurm-{jobidNumber}.out\"' ,'^.*?desktop is \S+(?P<vncDisplay>:[0-9]+)\s*$')
c.otp= siteConfig.cmdRegEx('\'cat ~/.vnc/clearpass\'','^(?P<vncPasswd>\S+)$')
c.agent=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=yes -l {username} {loginHost} \"/usr/bin/ssh -A {execHost} \\"echo agent_hello; bash \\"\"','agent_hello',async=True)
c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=yes -L {localPortNumber}:{execHost}:{remotePortNumber} -l {username} {loginHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
#c.agent=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -l {username} {execHost} "echo agent_hello; bash "','agent_hello',async=True)
#c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -L {localPortNumber}:localhost:{remotePortNumber} -l {username} {execHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
cmd='"/usr/bin/ssh {execHost} \'export DISPLAY={vncDisplay};timeout 15 /usr/local/bin/cat_dbus_session_file.sh\'"'
regex='^DBUS_SESSION_BUS_ADDRESS=(?P<dbusSessionBusAddress>.*)$'
c.dbusSessionBusAddress=siteConfig.cmdRegEx(cmd,regex)
cmd='\"/usr/local/bin/get_ephemeral_port.py\"'
regex='^(?P<intermediateWebDavPortNumber>[0-9]+)$'
c.webDavIntermediatePort=siteConfig.cmdRegEx(cmd,regex,host='exec')
cmd='\"/usr/local/bin/get_ephemeral_port.py\"'
regex='^(?P<remoteWebDavPortNumber>[0-9]+)$'
c.webDavRemotePort=siteConfig.cmdRegEx(cmd,regex,host='exec')
# Below, I initially tried to respect the user's Nautilus setting of always_use_location_entry and change it back after launching Nautilus,
# but doing so changes this setting in already-running Nautilus windows, and I want the user to see Nautilus's location bar when showing
# them the WebDav share. So now, I just brutally change the user's Nautilus location-bar setting to always_use_location_entry.
# Note that we might end up mounting WebDAV in a completely different way (e.g. using wdfs), but for now I'm trying to make the user
# experience similar on MASSIVE and the CVL. On MASSIVE, users are not automatically added to the "fuse" group, but they can still
# access a WebDAV share within Konqueror. The method below for the CVL/Nautilus does require fuse membership, but it ends up looking
# similar to MASSIVE/Konqueror from the user's point of view.
cmd="\"/usr/bin/ssh {execHost} \\\"export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};echo \\\\\\\"import pexpect;child = pexpect.spawn('gvfs-mount dav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}');child.expect('Password: ');child.sendline('{vncPasswd}');child.expect(pexpect.EOF);child.close();print 'gvfs-mount returned ' + str(child.exitstatus)\\\\\\\" {pipe} python\\\"\""
regex='^gvfs-mount returned (?P<webDavMountingExitCode>.*)$'
c.webDavMount=siteConfig.cmdRegEx(cmd,regex)
cmd="\"/usr/bin/ssh {execHost} \\\"export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};/usr/bin/gconftool-2 --type=Boolean --set /apps/nautilus/preferences/always_use_location_entry true {ampersand}{ampersand} DISPLAY={vncDisplay} xdg-open dav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\\\"\""
c.openWebDavShareInRemoteFileBrowser=siteConfig.cmdRegEx(cmd)
cmd='"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress}; DISPLAY={vncDisplay} xwininfo -root -tree\'"'
regex= '^\s+(?P<webDavWindowID>\S+)\s+"{homeDirectoryWebDavShareName}.*Browser.*$'
c.webDavWindowID=siteConfig.cmdRegEx(cmd,regex)
cmd = '"/usr/bin/ssh {execHost} \'echo -e \\"You can access your local home directory in Nautilus File Browser, using the location:\\n\\ndav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\\n\\nYour one-time password is {vncPasswd}\\" > ~/.vnc/\\$(hostname){vncDisplay}-webdav.txt\'"'
c.displayWebDavInfoDialogOnRemoteDesktop=siteConfig.cmdRegEx(cmd)
cmd='{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -oExitOnForwardFailure=yes -R {remoteWebDavPortNumber}:localhost:{localWebDavPortNumber} -l {username} {execHost} "echo tunnel_hello; bash"'
regex='tunnel_hello'
c.webDavTunnel=siteConfig.cmdRegEx(cmd,regex,async=True)
# 1. I'm using gvfs-mount --unmount-scheme dav for now, to unmount all GVFS WebDAV mounts,
# because using "gvfs-mount --unmount " on a specific mount point from a Launcher
# subprocess doesn't seem to work reliably, even though it works fine outside of the
# Launcher.
# 2. I'm using timeout with gvfs-mount, because sometimes the process never exits
# when unmounting, even though the unmounting operation is complete.
#cmd = '"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};DISPLAY={vncDisplay} timeout 3 gvfs-mount -u \".gvfs/WebDAV on localhost\"\'"'
cmd = '"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};export DISPLAY={vncDisplay};timeout 1 gvfs-mount --unmount-scheme dav\'"'
c.webDavUnmount=siteConfig.cmdRegEx(cmd)
cmd = '"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};export DISPLAY={vncDisplay}; wmctrl -F -i -c {webDavWindowID}\'"'
c.webDavCloseWindow=siteConfig.cmdRegEx(cmd)
cmd = '"/usr/bin/ssh {execHost} \'module load keyutility ; mountUtility.py\'"'
#c.onConnectScript = siteConfig.cmdRegEx(cmd)
return c
def getCVLSiteConfigSlurm(partition):
cvlvisible={}
cvlvisible['usernamePanel']=True
cvlvisible['resourcePanel']='Advanced'
cvlvisible['resolutionPanel']='Advanced'
cvlvisible['cipherPanel']='Advanced'
cvlvisible['debugCheckBoxPanel']='Advanced'
cvlvisible['advancedCheckBoxPanel']=True
cvlvisible['label_hours']=True
cvlvisible['jobParams_hours']=True
cvlvisible['label_ppn']=True
cvlvisible['jobParams_ppn']=True
cvlvisible['label_nodes']=True
cvlvisible['jobParams_nodes']=True
c = siteConfig.siteConfig()
cvlstrings = sshKeyDistDisplayStringsCVL()
c.displayStrings.__dict__.update(cvlstrings.__dict__)
c.visibility=cvlvisible
c.directConnect=True
c.authURL=None
c.loginHost='118.138.233.195'
c.defaults['jobParams_ppn']=1
c.defaults['jobParams_hours']=48
c.defaults['jobParams_mem']=4
cmd = '\"squeue -u {username} -o \\"%i %L\\" | tail -n -1\"'
regex='(?P<jobid>(?P<jobidNumber>[0-9]+)) (?P<remainingWalltime>.*)$'
c.listAll=siteConfig.cmdRegEx(cmd,regex,requireMatch=False)
c.messageRegexs=[re.compile("^INFO:(?P<info>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^WARN:(?P<warn>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^ERROR:(?P<error>.*(?:\n|\r\n?))",re.MULTILINE)]
#cmd='\"squeue -j {jobidNumber} -o "%N" | tail -n -1 | cut -f 1 -d \',\' | xargs -iname getent hosts name | cut -f 1 -d \' \' \"'
cmd='\"scontrol show job {jobidNumber} | grep BatchHost | cut -f 2 -d \'=\' | xargs -iname getent hosts name | cut -f 1 -d \' \' \"'
regex='^(?P<execHost>.*)$'
c.execHost = siteConfig.cmdRegEx(cmd,regex)
cmd='\"groups | sed \'s@ @\\n@g\'\"' # '\'groups | sed \'s\/\\\\ \/\\\\\\\\n\/g\'\''
regex='^\s*(?P<group>\S+)\s*$'
c.getProjects = siteConfig.cmdRegEx(cmd,regex)
cmd='\"scontrol show job {jobidNumber}\"'
regex='JobState=RUNNING'
c.running=siteConfig.cmdRegEx(cmd,regex)
# cmd="\"mkdir ~/.vnc ; rm -f ~/.vnc/clearpass ; touch ~/.vnc/clearpass ; chmod 600 ~/.vnc/clearpass ; passwd=\"\'$\'\"( dd if=/dev/urandom bs=1 count=8 2>/dev/null | md5sum | cut -b 1-8 ) ; echo \"\'$\'\"passwd > ~/.vnc/clearpass ; module load turbovnc ; cat ~/.vnc/clearpass | vncpasswd -f > ~/.vnc/passwd ; chmod 600 ~/.vnc/passwd ; echo -e \'#!/bin/bash\\n/usr/local/bin/vncsession --vnc turbovnc --geometry {resolution} ; sleep 36000000 \' | sbatch -p %s -N {nodes} -n {ppn} --time={hours}:00:00 -J desktop_{username} -o .vnc/slurm-%%j.out \""%partition
cmd="\" echo -e \'#!/bin/bash\\n/usr/local/bin/vncsession --vnc turbovnc --geometry {resolution} ; sleep 36000000 \' | sbatch -p %s -N {nodes} --mincpus {ppn} --time={hours}:00:00 -J desktop_{username} -o .vnc/slurm-%%j.out \""%partition
regex="^Submitted batch job (?P<jobid>(?P<jobidNumber>[0-9]+))$"
c.startServer=siteConfig.cmdRegEx(cmd,regex)
c.stop=siteConfig.cmdRegEx('\"scancel {jobidNumber}\"')
c.stopForRestart=siteConfig.cmdRegEx('\"scancel {jobidNumber}\"')
c.vncDisplay= siteConfig.cmdRegEx('\"cat .vnc/slurm-{jobidNumber}.out\"' ,'^.*?started on display \S+(?P<vncDisplay>:[0-9]+)\s*$',host='exec')
cmd= '\"module load turbovnc ; vncpasswd -o -display localhost{vncDisplay}\"'
regex='^\s*Full control one-time password: (?P<vncPasswd>[0-9]+)\s*$'
c.otp=siteConfig.cmdRegEx(cmd,regex,host='exec')
# c.otp= siteConfig.cmdRegEx('\'cat ~/.vnc/clearpass\'','^(?P<vncPasswd>\S+)$')
c.agent=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -l {username} {execHost} "echo agent_hello; bash "','agent_hello',async=True)
c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -L {localPortNumber}:localhost:{remotePortNumber} -l {username} {execHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
cmd='"/usr/bin/ssh {execHost} \'export DISPLAY={vncDisplay};timeout 15 /usr/local/bin/cat_dbus_session_file.sh\'"'
regex='^DBUS_SESSION_BUS_ADDRESS=(?P<dbusSessionBusAddress>.*)$'
c.dbusSessionBusAddress=siteConfig.cmdRegEx(cmd,regex)
cmd='\"/usr/local/bin/get_ephemeral_port.py\"'
regex='^(?P<intermediateWebDavPortNumber>[0-9]+)$'
c.webDavIntermediatePort=siteConfig.cmdRegEx(cmd,regex,host='exec')
cmd='\"/usr/local/bin/get_ephemeral_port.py\"'
regex='^(?P<remoteWebDavPortNumber>[0-9]+)$'
c.webDavRemotePort=siteConfig.cmdRegEx(cmd,regex,host='exec')
# Below, I initially tried to respect the user's Nautilus setting of always_use_location_entry and change it back after launching Nautilus,
# but doing so changes this setting in already-running Nautilus windows, and I want the user to see Nautilus's location bar when showing
# them the WebDav share. So now, I just brutally change the user's Nautilus location-bar setting to always_use_location_entry.
# Note that we might end up mounting WebDAV in a completely different way (e.g. using wdfs), but for now I'm trying to make the user
# experience similar on MASSIVE and the CVL. On MASSIVE, users are not automatically added to the "fuse" group, but they can still
# access a WebDAV share within Konqueror. The method below for the CVL/Nautilus does require fuse membership, but it ends up looking
# similar to MASSIVE/Konqueror from the user's point of view.
cmd="\"/usr/bin/ssh {execHost} \\\"export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};echo \\\\\\\"import pexpect;child = pexpect.spawn('gvfs-mount dav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}');child.expect('Password: ');child.sendline('{vncPasswd}');child.expect(pexpect.EOF);child.close();print 'gvfs-mount returned ' + str(child.exitstatus)\\\\\\\" {pipe} python\\\"\""
regex='^gvfs-mount returned (?P<webDavMountingExitCode>.*)$'
c.webDavMount=siteConfig.cmdRegEx(cmd,regex)
cmd="\"/usr/bin/ssh {execHost} \\\"export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};/usr/bin/gconftool-2 --type=Boolean --set /apps/nautilus/preferences/always_use_location_entry true {ampersand}{ampersand} DISPLAY={vncDisplay} xdg-open dav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\\\"\""
c.openWebDavShareInRemoteFileBrowser=siteConfig.cmdRegEx(cmd)
cmd='"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress}; DISPLAY={vncDisplay} xwininfo -root -tree\'"'
regex= '^\s+(?P<webDavWindowID>\S+)\s+"{homeDirectoryWebDavShareName}.*Browser.*$'
c.webDavWindowID=siteConfig.cmdRegEx(cmd,regex)
cmd = '"/usr/bin/ssh {execHost} \'echo -e \\"You can access your local home directory in Nautilus File Browser, using the location:\\n\\ndav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\\n\\nYour one-time password is {vncPasswd}\\" > ~/.vnc/\\$(hostname){vncDisplay}-webdav.txt\'"'
c.displayWebDavInfoDialogOnRemoteDesktop=siteConfig.cmdRegEx(cmd)
cmd='{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -oExitOnForwardFailure=yes -R {remoteWebDavPortNumber}:localhost:{localWebDavPortNumber} -l {username} {execHost} "echo tunnel_hello; bash"'
regex='tunnel_hello'
c.webDavTunnel=siteConfig.cmdRegEx(cmd,regex,async=True)
# 1. I'm using gvfs-mount --unmount-scheme dav for now, to unmount all GVFS WebDAV mounts,
# because using "gvfs-mount --unmount " on a specific mount point from a Launcher
# subprocess doesn't seem to work reliably, even though it works fine outside of the
# Launcher.
# 2. I'm using timeout with gvfs-mount, because sometimes the process never exits
# when unmounting, even though the unmounting operation is complete.
#cmd = '"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};DISPLAY={vncDisplay} timeout 3 gvfs-mount -u \".gvfs/WebDAV on localhost\"\'"'
cmd = '"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};export DISPLAY={vncDisplay};timeout 1 gvfs-mount --unmount-scheme dav\'"'
c.webDavUnmount=siteConfig.cmdRegEx(cmd)
cmd = '"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};export DISPLAY={vncDisplay}; wmctrl -F -i -c {webDavWindowID}\'"'
c.webDavCloseWindow=siteConfig.cmdRegEx(cmd)
cmd = '"/usr/bin/ssh {execHost} \'module load keyutility ; mountUtility.py\'"'
#c.onConnectScript = siteConfig.cmdRegEx(cmd)
return c
def getCVLSiteConfigXML(queue):
cvlvisible={}
cvlvisible['usernamePanel']=True
cvlvisible['resourcePanel']='Advanced'
cvlvisible['resolutionPanel']='Advanced'
cvlvisible['cipherPanel']='Advanced'
cvlvisible['debugCheckBoxPanel']='Advanced'
cvlvisible['advancedCheckBoxPanel']=True
cvlvisible['label_hours']=True
cvlvisible['jobParams_hours']=True
cvlvisible['label_ppn']=True
cvlvisible['jobParams_ppn']=True
cvlvisible['label_nodes']=True
cvlvisible['jobParams_nodes']=True
c = siteConfig.siteConfig()
cvlstrings = sshKeyDistDisplayStringsCVL()
c.displayStrings.__dict__.update(cvlstrings.__dict__)
c.visibility=cvlvisible
c.loginHost='login.cvl.massive.org.au'
c.directConnect=True
c.authURL="https://autht.massive.org.au/cvl/"
c.loginHost='login.cvl.massive.org.au'
c.defaults['jobParams_ppn']=1
c.defaults['jobParams_hours']=48
c.defaults['jobParams_mem']=4
cmd = '\"module load pbs ; qstat -x | xmlstarlet sel -t -m \\"/Data/Job[starts-with(Job_Owner/text(),\'{username}@\') and starts-with(Job_Name/text(),\'desktop\') and job_state/text()!=\'C\']\\" -v \\" concat(./Job_Id/text(),\' \',./Walltime/Remaining/text()) \\" -n - 2>/dev/null\"'
regex='(?P<jobid>(?P<jobidNumber>[0-9]+).\S+) (?P<remainingWalltime>.*)$'
c.listAll=siteConfig.cmdRegEx(cmd,regex,requireMatch=False)
c.messageRegexs=[re.compile("^INFO:(?P<info>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^WARN:(?P<warn>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^ERROR:(?P<error>.*(?:\n|\r\n?))",re.MULTILINE)]
cmd='\"module load pbs ; qstat -f {jobidNumber} | grep exec_host | sed \'s/\ \ */\ /g\' | cut -f 4 -d \' \' | cut -f 1 -d \'/\' | xargs -iname hostn name | grep address | sed \'s/\ \ */\ /g\' | cut -f 3 -d \' \' | xargs -iip echo execHost ip; qstat -f {jobidNumber}\"'
regex='^\s*execHost (?P<execHost>\S+)\s*$'
c.execHost = siteConfig.cmdRegEx(cmd,regex)
cmd='\"groups | sed \'s@ @\\n@g\'\"' # '\'groups | sed \'s\/\\\\ \/\\\\\\\\n\/g\'\''
regex='^\s*(?P<group>\S+)\s*$'
c.getProjects = siteConfig.cmdRegEx(cmd,regex)
cmd='\"module load pbs ; module load maui ; qstat -f {jobidNumber} -x\"'
regex='.*<job_state>R</job_state>.*'
c.running=siteConfig.cmdRegEx(cmd,regex)
cmd="\"module load pbs ; module load maui ; echo \'module load pbs ; /usr/local/bin/vncsession --vnc turbovnc --geometry {resolution} ; sleep 36000000 \' | qsub -q %s -l nodes=1:ppn=1 -l walltime={hours}:00:00 -N desktop_{username} -o .vnc/ -e .vnc/ \""%queue
regex="^(?P<jobid>(?P<jobidNumber>[0-9]+)\.\S+)\s*$"
c.startServer=siteConfig.cmdRegEx(cmd,regex)
c.stop=siteConfig.cmdRegEx('\"module load pbs ; module load maui ; qdel -a {jobidNumber}\"')
c.stopForRestart=siteConfig.cmdRegEx('\"module load pbs ; module load maui ; qdel {jobidNumber}\"')
c.vncDisplay= siteConfig.cmdRegEx('\"cat /var/spool/torque/spool/{jobidNumber}.*\"' ,'^.*?started on display \S+(?P<vncDisplay>:[0-9]+)\s*$',host='exec')
cmd= '\"module load turbovnc ; vncpasswd -o -display localhost{vncDisplay}\"'
regex='^\s*Full control one-time password: (?P<vncPasswd>[0-9]+)\s*$'
c.otp=siteConfig.cmdRegEx(cmd,regex,host='exec')
c.agent=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -l {username} {execHost} "echo agent_hello; bash "','agent_hello',async=True)
c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -L {localPortNumber}:localhost:{remotePortNumber} -l {username} {execHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
cmd='"/usr/bin/ssh {execHost} \'export DISPLAY={vncDisplay};timeout 15 /usr/local/bin/cat_dbus_session_file.sh\'"'
regex='^DBUS_SESSION_BUS_ADDRESS=(?P<dbusSessionBusAddress>.*)$'
c.dbusSessionBusAddress=siteConfig.cmdRegEx(cmd,regex)
cmd='\"/usr/local/bin/get_ephemeral_port.py\"'
regex='^(?P<intermediateWebDavPortNumber>[0-9]+)$'
c.webDavIntermediatePort=siteConfig.cmdRegEx(cmd,regex,host='exec')
cmd='\"/usr/local/bin/get_ephemeral_port.py\"'
regex='^(?P<remoteWebDavPortNumber>[0-9]+)$'
c.webDavRemotePort=siteConfig.cmdRegEx(cmd,regex,host='exec')
# Below, I initially tried to respect the user's Nautilus setting of always_use_location_entry and change it back after launching Nautilus,
# but doing so changes this setting in already-running Nautilus windows, and I want the user to see Nautilus's location bar when showing
# them the WebDav share. So now, I just brutally change the user's Nautilus location-bar setting to always_use_location_entry.
# Note that we might end up mounting WebDAV in a completely different way (e.g. using wdfs), but for now I'm trying to make the user
# experience similar on MASSIVE and the CVL. On MASSIVE, users are not automatically added to the "fuse" group, but they can still
# access a WebDAV share within Konqueror. The method below for the CVL/Nautilus does require fuse membership, but it ends up looking
# similar to MASSIVE/Konqueror from the user's point of view.
cmd="\"/usr/bin/ssh {execHost} \\\"export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};echo \\\\\\\"import pexpect;child = pexpect.spawn('gvfs-mount dav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}');child.expect('Password: ');child.sendline('{vncPasswd}');child.expect(pexpect.EOF);child.close();print 'gvfs-mount returned ' + str(child.exitstatus)\\\\\\\" {pipe} python\\\"\""
regex='^gvfs-mount returned (?P<webDavMountingExitCode>.*)$'
c.webDavMount=siteConfig.cmdRegEx(cmd,regex)
cmd="\"/usr/bin/ssh {execHost} \\\"export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};/usr/bin/gconftool-2 --type=Boolean --set /apps/nautilus/preferences/always_use_location_entry true {ampersand}{ampersand} DISPLAY={vncDisplay} xdg-open dav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\\\"\""
c.openWebDavShareInRemoteFileBrowser=siteConfig.cmdRegEx(cmd)
cmd='"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress}; DISPLAY={vncDisplay} xwininfo -root -tree\'"'
regex= '^\s+(?P<webDavWindowID>\S+)\s+"{homeDirectoryWebDavShareName}.*Browser.*$'
c.webDavWindowID=siteConfig.cmdRegEx(cmd,regex)
cmd = '"/usr/bin/ssh {execHost} \'echo -e \\"You can access your local home directory in Nautilus File Browser, using the location:\\n\\ndav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\\n\\nYour one-time password is {vncPasswd}\\" > ~/.vnc/\\$(hostname){vncDisplay}-webdav.txt\'"'
c.displayWebDavInfoDialogOnRemoteDesktop=siteConfig.cmdRegEx(cmd)
cmd='{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -oExitOnForwardFailure=yes -R {remoteWebDavPortNumber}:localhost:{localWebDavPortNumber} -l {username} {execHost} "echo tunnel_hello; bash"'
regex='tunnel_hello'
c.webDavTunnel=siteConfig.cmdRegEx(cmd,regex,async=True)
# 1. I'm using gvfs-mount --unmount-scheme dav for now, to unmount all GVFS WebDAV mounts,
# because using "gvfs-mount --unmount " on a specific mount point from a Launcher
# subprocess doesn't seem to work reliably, even though it works fine outside of the
# Launcher.
# 2. I'm using timeout with gvfs-mount, because sometimes the process never exits
# when unmounting, even though the unmounting operation is complete.
#cmd = '"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};DISPLAY={vncDisplay} timeout 3 gvfs-mount -u \".gvfs/WebDAV on localhost\"\'"'
cmd = '"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};export DISPLAY={vncDisplay};timeout 1 gvfs-mount --unmount-scheme dav\'"'
c.webDavUnmount=siteConfig.cmdRegEx(cmd)
cmd = '"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};export DISPLAY={vncDisplay}; wmctrl -F -i -c {webDavWindowID}\'"'
c.webDavCloseWindow=siteConfig.cmdRegEx(cmd)
cmd = '"/usr/bin/ssh {execHost} \'module load keyutility ; mountUtility.py\'"'
c.onConnectScript = siteConfig.cmdRegEx(cmd)
return c
def getCVLSiteConfig(queue):
cvlvisible={}
cvlvisible['usernamePanel']=True
cvlvisible['resourcePanel']='Advanced'
cvlvisible['resolutionPanel']='Advanced'
cvlvisible['cipherPanel']='Advanced'
cvlvisible['debugCheckBoxPanel']='Advanced'
cvlvisible['advancedCheckBoxPanel']=True
cvlvisible['label_hours']=True
cvlvisible['jobParams_hours']=True
cvlvisible['label_ppn']=True
cvlvisible['jobParams_ppn']=True
cvlvisible['label_nodes']=True
cvlvisible['jobParams_nodes']=True
c = siteConfig.siteConfig()
cvlstrings = sshKeyDistDisplayStringsCVL()
c.displayStrings.__dict__.update(cvlstrings.__dict__)
c.visibility=cvlvisible
c.authURL="https://autht.massive.org.au/cvl/"
c.loginHost='login.cvl.massive.org.au'
c.defaults['jobParams_ppn']=1
c.defaults['jobParams_hours']=48
c.defaults['jobParams_mem']=4
c.directConnect=True
c.messageRegexs=[re.compile("^INFO:(?P<info>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^WARN:(?P<warn>.*(?:\n|\r\n?))",re.MULTILINE),re.compile("^ERROR:(?P<error>.*(?:\n|\r\n?))",re.MULTILINE)]
cmd='\"module load pbs ; qstat -f {jobidNumber} | grep exec_host | sed \'s/\ \ */\ /g\' | cut -f 4 -d \' \' | cut -f 1 -d \'/\' | xargs -iname hostn name | grep address | sed \'s/\ \ */\ /g\' | cut -f 3 -d \' \' | xargs -iip echo execHost ip; qstat -f {jobidNumber}\"'
regex='^\s*execHost (?P<execHost>\S+)\s*$'
c.execHost = siteConfig.cmdRegEx(cmd,regex)
cmd='\"groups | sed \'s@ @\\n@g\'\"' # '\'groups | sed \'s\/\\\\ \/\\\\\\\\n\/g\'\''
regex='^\s*(?P<group>\S+)\s*$'
c.getProjects = siteConfig.cmdRegEx(cmd,regex)
c.listAll=siteConfig.cmdRegEx('\"module load pbs ; qstat -u {username} | tail -n +6\"','^\s*(?P<jobid>(?P<jobidNumber>[0-9]+).\S+)\s+\S+\s+(?P<queue>%s)\s+(?P<jobname>desktop_\S+)\s+(?P<sessionID>\S+)\s+(?P<nodes>\S+)\s+(?P<tasks>\S+)\s+(?P<mem>\S+)\s+(?P<reqTime>\S+)\s+(?P<state>[^C])\s+(?P<elapTime>\S+)\s*$'%queue,requireMatch=False)
cmd='\"module load pbs ; module load maui ; qstat -f {jobidNumber} -x\"'
regex='.*<job_state>R</job_state>.*'
c.running=siteConfig.cmdRegEx(cmd,regex)
cmd="\"module load pbs ; module load maui ; echo \'module load pbs ; /usr/local/bin/vncsession --vnc turbovnc --geometry {resolution} ; sleep 36000000 \' | qsub -q %s -l nodes=1:ppn=1 -l walltime={hours}:00:00 -N desktop_{username} -o .vnc/ -e .vnc/ \""%queue
regex="^(?P<jobid>(?P<jobidNumber>[0-9]+)\.\S+)\s*$"
c.startServer=siteConfig.cmdRegEx(cmd,regex)
c.stop=siteConfig.cmdRegEx('\"module load pbs ; module load maui ; qdel -a {jobidNumber}\"')
c.stopForRestart=siteConfig.cmdRegEx('\"module load pbs ; module load maui ; qdel {jobidNumber}\"')
c.vncDisplay= siteConfig.cmdRegEx('\"cat /var/spool/torque/spool/{jobidNumber}.*\"' ,'^.*?started on display \S+(?P<vncDisplay>:[0-9]+)\s*$',host='exec')
cmd= '\"module load turbovnc ; vncpasswd -o -display localhost{vncDisplay}\"'
regex='^\s*Full control one-time password: (?P<vncPasswd>[0-9]+)\s*$'
c.otp=siteConfig.cmdRegEx(cmd,regex,host='exec')
c.agent=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -l {username} {execHost} "echo agent_hello; bash "','agent_hello',async=True)
c.tunnel=siteConfig.cmdRegEx('{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -L {localPortNumber}:localhost:{remotePortNumber} -l {username} {execHost} "echo tunnel_hello; bash"','tunnel_hello',async=True)
cmd='"/usr/bin/ssh {execHost} \'export DISPLAY={vncDisplay};timeout 15 /usr/local/bin/cat_dbus_session_file.sh\'"'
regex='^DBUS_SESSION_BUS_ADDRESS=(?P<dbusSessionBusAddress>.*)$'
c.dbusSessionBusAddress=siteConfig.cmdRegEx(cmd,regex)
cmd='\"/usr/local/bin/get_ephemeral_port.py\"'
regex='^(?P<intermediateWebDavPortNumber>[0-9]+)$'
c.webDavIntermediatePort=siteConfig.cmdRegEx(cmd,regex,host='exec')
cmd='\"/usr/local/bin/get_ephemeral_port.py\"'
regex='^(?P<remoteWebDavPortNumber>[0-9]+)$'
c.webDavRemotePort=siteConfig.cmdRegEx(cmd,regex,host='exec')
# Below, I initially tried to respect the user's Nautilus setting of always_use_location_entry and change it back after launching Nautilus,
# but doing so changes this setting in already-running Nautilus windows, and I want the user to see Nautilus's location bar when showing
# them the WebDav share. So now, I just brutally change the user's Nautilus location-bar setting to always_use_location_entry.
# Note that we might end up mounting WebDAV in a completely different way (e.g. using wdfs), but for now I'm trying to make the user
# experience similar on MASSIVE and the CVL. On MASSIVE, users are not automatically added to the "fuse" group, but they can still
# access a WebDAV share within Konqueror. The method below for the CVL/Nautilus does require fuse membership, but it ends up looking
# similar to MASSIVE/Konqueror from the user's point of view.
cmd="\"/usr/bin/ssh {execHost} \\\"export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};echo \\\\\\\"import pexpect;child = pexpect.spawn('gvfs-mount dav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}');child.expect('Password: ');child.sendline('{vncPasswd}');child.expect(pexpect.EOF);child.close();print 'gvfs-mount returned ' + str(child.exitstatus)\\\\\\\" {pipe} python\\\"\""
regex='^gvfs-mount returned (?P<webDavMountingExitCode>.*)$'
c.webDavMount=siteConfig.cmdRegEx(cmd,regex)
cmd="\"/usr/bin/ssh {execHost} \\\"export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress};/usr/bin/gconftool-2 --type=Boolean --set /apps/nautilus/preferences/always_use_location_entry true {ampersand}{ampersand} DISPLAY={vncDisplay} xdg-open dav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\\\"\""
c.openWebDavShareInRemoteFileBrowser=siteConfig.cmdRegEx(cmd)
cmd='"/usr/bin/ssh {execHost} \'export DBUS_SESSION_BUS_ADDRESS={dbusSessionBusAddress}; DISPLAY={vncDisplay} xwininfo -root -tree\'"'
regex= '^\s+(?P<webDavWindowID>\S+)\s+"{homeDirectoryWebDavShareName}.*Browser.*$'
c.webDavWindowID=siteConfig.cmdRegEx(cmd,regex)
cmd = '"/usr/bin/ssh {execHost} \'echo -e \\"You can access your local home directory in Nautilus File Browser, using the location:\\n\\ndav://{localUsername}@localhost:{remoteWebDavPortNumber}/{homeDirectoryWebDavShareName}\\n\\nYour one-time password is {vncPasswd}\\" > ~/.vnc/\\$(hostname){vncDisplay}-webdav.txt\'"'
c.displayWebDavInfoDialogOnRemoteDesktop=siteConfig.cmdRegEx(cmd)
cmd='{sshBinary} -A -c {cipher} -t -t -oStrictHostKeyChecking=no -oExitOnForwardFailure=yes -R {remoteWebDavPortNumber}:localhost:{localWebDavPortNumber} -l {username} {execHost} "echo tunnel_hello; bash"'
regex='tunnel_hello'
c.webDavTunnel=siteConfig.cmdRegEx(cmd,regex,async=True)
# 1. I'm using gvfs-mount --unmount-scheme dav for now, to unmount all GVFS WebDAV mounts,
# because using "gvfs-mount --unmount " on a specific mount point from a Launcher
# subprocess doesn't seem to work reliably, even though it works fine outside of the