@@ -6,11 +6,12 @@ import {
6
6
NumberInput ,
7
7
TextAreaInput
8
8
} from './RunDialogComponents' ;
9
+ import { useCollapse } from "react-collapsed" ;
9
10
10
11
interface RemoteRunDialogProps {
11
12
remoteRunTypes ;
12
- remoteRunConfigs : { id : string ; run_type : string ; run_config_name : string ; command : string } [ ] ;
13
- lastConfig : { run_type : string ; run_config_name : string ; command : string } | null ;
13
+ remoteRunConfigs : { id : string ; run_type : string ; run_config_name : string ; command : string ; project : string } [ ] ;
14
+ lastConfig : { run_type : string ; run_config_name : string ; command : string ; project : string } | null ;
14
15
childStringNodes : string [ ] ;
15
16
childBoolNodes : string [ ] ;
16
17
childIntNodes : string [ ] ;
@@ -31,6 +32,12 @@ export const RemoteRunDialog: React.FC<RemoteRunDialogProps> = ({
31
32
const [ remoteRunType , setRemoteRunType ] = useState ( "" ) ;
32
33
const [ remoteRunConfig , setRemoteRunConfig ] = useState ( "" ) ;
33
34
const [ command , setCommand ] = useState ( "" ) ;
35
+ const [ project , setProject ] = useState ( "" ) ;
36
+ const [ isMonitoringEnabled , setIsMonitoringEnabled ] = useState ( false ) ;
37
+ const [ isStageOutEnabled , setIsStageOutEnabled ] = useState ( false ) ;
38
+ const [ filesystem , setFilesystem ] = useState ( 'HOME' ) ;
39
+ const [ python , setPython ] = useState ( 'python3.10' ) ;
40
+ const [ modules , setModules ] = useState ( 'Python' ) ;
34
41
const [ placeholders , setPlaceholders ] = useState < string [ ] > ( [ ] ) ;
35
42
const [ formattedCommand , setFormattedCommand ] = useState ( "" ) ;
36
43
const [ sectionsCollapsed , setSectionsCollapsed ] = useState ( {
@@ -51,6 +58,9 @@ export const RemoteRunDialog: React.FC<RemoteRunDialogProps> = ({
51
58
setRemoteRunType ( lastConfig . run_type ) ;
52
59
setRemoteRunConfig ( lastConfig . run_config_name ) ;
53
60
setCommand ( lastConfig . command ) ;
61
+ setProject ( lastConfig . project ) ;
62
+ setIsMonitoringEnabled ( false ) ;
63
+ setIsStageOutEnabled ( false ) ;
54
64
const extractedPlaceholders = extractPlaceholders ( lastConfig . command ) ;
55
65
setPlaceholders ( extractedPlaceholders ) ;
56
66
setInputValues ( prefillInputValues ( lastConfig , extractedPlaceholders ) ) ;
@@ -70,6 +80,9 @@ export const RemoteRunDialog: React.FC<RemoteRunDialogProps> = ({
70
80
setRemoteRunType ( type ) ;
71
81
setRemoteRunConfig ( "-" ) ;
72
82
setCommand ( "" ) ;
83
+ setProject ( "" ) ;
84
+ setIsMonitoringEnabled ( false ) ;
85
+ setIsStageOutEnabled ( false ) ;
73
86
setPlaceholders ( [ ] ) ;
74
87
setInputValues ( { } ) ;
75
88
} ;
@@ -79,6 +92,9 @@ export const RemoteRunDialog: React.FC<RemoteRunDialogProps> = ({
79
92
setRemoteRunConfig ( configName ) ;
80
93
if ( configName === "-" ) {
81
94
setCommand ( "" ) ;
95
+ setProject ( "" ) ;
96
+ setIsMonitoringEnabled ( false ) ;
97
+ setIsStageOutEnabled ( false ) ;
82
98
setPlaceholders ( [ ] ) ;
83
99
setInputValues ( { } ) ;
84
100
} else {
@@ -89,6 +105,14 @@ export const RemoteRunDialog: React.FC<RemoteRunDialogProps> = ({
89
105
setPlaceholders ( extractedPlaceholders ) ;
90
106
setInputValues ( prefillInputValues ( selectedConfig , extractedPlaceholders ) ) ;
91
107
}
108
+ if ( configName === 'JUWELS' ) {
109
+ setFilesystem ( 'HOME' ) ;
110
+ setPython ( 'python3.11' ) ;
111
+ } else {
112
+ setFilesystem ( 'PROJECT' ) ;
113
+ setPython ( 'python3.10' ) ;
114
+ }
115
+ setModules ( 'Python' ) ;
92
116
}
93
117
} ;
94
118
@@ -167,11 +191,61 @@ export const RemoteRunDialog: React.FC<RemoteRunDialogProps> = ({
167
191
const hasArguments = childStringNodes . length > 0 || childBoolNodes . length > 0 ||
168
192
childIntNodes . length > 0 || childFloatNodes . length > 0 ;
169
193
194
+ function Collapsible ( ) {
195
+ const { getCollapseProps, getToggleProps, isExpanded } = useCollapse ( ) ;
196
+ return (
197
+ < div className = "collapsible" >
198
+ < div className = "header" { ...getToggleProps ( ) } >
199
+ { isExpanded ? 'Advanced setup' : 'Advanced setup' }
200
+ < div className = "icon" >
201
+ < i className = { 'fas fa-chevron-circle-' + ( isExpanded ? 'up' : 'down' ) } > </ i >
202
+ </ div >
203
+ </ div >
204
+ < div { ...getCollapseProps ( ) } >
205
+ < div >
206
+ Filesystem:
207
+ < div >
208
+ < input
209
+ name = 'filesystem'
210
+ defaultValue = { filesystem }
211
+ title = { 'Filesystem to use on HPC for preparing the environment' }
212
+ style = { { width : 300 , fontSize : 13 } } />
213
+ </ div >
214
+ Python dir:
215
+ < div >
216
+ < input
217
+ name = 'python'
218
+ defaultValue = { python }
219
+ title = { 'Python directory to use on HPC' }
220
+ style = { { width : 300 , fontSize : 13 } } />
221
+ </ div >
222
+ Modules to load:
223
+ < div >
224
+ < input
225
+ name = 'modules'
226
+ defaultValue = { modules }
227
+ title = { 'Modules to load on HPC' }
228
+ style = { { width : 300 , fontSize : 13 } } />
229
+ </ div >
230
+ Libraries to install:
231
+ < div >
232
+ < input
233
+ name = 'libraries'
234
+ defaultValue = { 'tvb-ext-xircuits,tvb-data' }
235
+ title = { 'Libraries to install on HPC' }
236
+ style = { { width : 300 , fontSize : 13 } } />
237
+ </ div >
238
+ </ div >
239
+ </ div >
240
+ </ div >
241
+ ) ;
242
+ }
243
+
170
244
return (
171
245
< form >
172
246
< h2 > Remote Run</ h2 >
173
247
174
- { renderCollapsibleSection ( " Available Run Type" , (
248
+ { renderCollapsibleSection ( ' Available Run Type' , (
175
249
< div style = { styles . select } >
176
250
< HTMLSelect
177
251
onChange = { ( e ) => handleTypeChange ( e ) }
@@ -187,9 +261,9 @@ export const RemoteRunDialog: React.FC<RemoteRunDialogProps> = ({
187
261
) ) }
188
262
</ HTMLSelect >
189
263
</ div >
190
- ) , " runType" ) }
264
+ ) , ' runType' ) }
191
265
192
- { renderCollapsibleSection ( " Available Run Config" , (
266
+ { renderCollapsibleSection ( ' Available Run Config' , (
193
267
< div style = { styles . select } >
194
268
< HTMLSelect
195
269
onChange = { ( e ) => handleConfigChange ( e ) }
@@ -210,6 +284,41 @@ export const RemoteRunDialog: React.FC<RemoteRunDialogProps> = ({
210
284
</ div >
211
285
) , "runConfig" ) }
212
286
287
+ { renderCollapsibleSection ( "Project" , (
288
+ < TextAreaInput
289
+ name = "project"
290
+ title = ""
291
+ oldValue = { project }
292
+ onChange = { ( ) => { } }
293
+ />
294
+ ) , "project" ) }
295
+
296
+ { renderCollapsibleSection ( "Launch Monitoring HPC" , (
297
+ < div >
298
+ < input type = { 'checkbox' }
299
+ title = { 'If checked, the HPC monitoring widget is opened up automatically in a new tab. This can be accessed from the Monitor HPC button as well.' }
300
+ name = 'monitoring'
301
+ checked = { isMonitoringEnabled }
302
+ onChange = { ( e ) => setIsMonitoringEnabled ( e . target . checked ) }
303
+ >
304
+ </ input >
305
+ </ div >
306
+ ) , "launchHPC" ) }
307
+
308
+ { renderCollapsibleSection ( "Stage-out results" , (
309
+ < div >
310
+ < input type = { 'checkbox' }
311
+ title = { 'If checked, the workflow waits for all HPC jobs to finish and stages-out the results. Otherwise, they can be downloaded manually from the HPC monitoring widget.' }
312
+ name = 'stage_out'
313
+ checked = { isStageOutEnabled }
314
+ onChange = { ( e ) => setIsStageOutEnabled ( e . target . checked ) }
315
+ >
316
+ </ input >
317
+ </ div >
318
+ ) , "launchHPC" ) }
319
+
320
+ < Collapsible />
321
+
213
322
{ renderCollapsibleSection ( "Command Template" , (
214
323
< TextAreaInput
215
324
name = "commandTemplate"
0 commit comments