@@ -28,7 +28,7 @@ import spock.lang.Unroll
28
28
29
29
/**
30
30
*
31
- * @author Satoshi Ohshima <[email protected] >
31
+ * @author Satoshi Ohshima <[email protected] >
32
32
*/
33
33
34
34
class TcsExecutorTest extends Specification {
@@ -86,20 +86,60 @@ class TcsExecutorTest extends Specification {
86
86
task. workDir = Paths . get(' /work/path' )
87
87
task. name = ' the task name'
88
88
89
+ // 1min job
89
90
when :
90
91
task. index = 21
91
92
task. config = new TaskConfig ()
92
93
task. config. time = ' 00:10:00'
93
94
then :
94
95
executor. getHeaders(task) == '''
95
- #PJM -N nf-the_task_name
96
- #PJM -j
97
- #PJM -S
98
- #PJM -L elapse=00:10:00
96
+ #PJM -N nf-the_task_name
97
+ #PJM -L elapse=00:10:00
98
+ #PJM -o /work/path/.command.log
99
+ #PJM -j
100
+ #PJM -S
101
+ '''
102
+ .stripIndent(). leftTrim()
103
+
104
+ // 1hour job
105
+ when :
106
+ task. index = 22
107
+ task. config = new TaskConfig ()
108
+ task. config. time = ' 01:00:00'
109
+ task. name = ' 1hour job'
110
+ then :
111
+ executor. getHeaders(task) == '''
112
+ #PJM -N nf-1hour_job
113
+ #PJM -L elapse=01:00:00
114
+ #PJM -o /work/path/.command.log
115
+ #PJM -j
116
+ #PJM -S
117
+ '''
118
+ .stripIndent(). leftTrim()
119
+
120
+ // job array (bulk job)
121
+ when : ' with job array (bulk job)'
122
+ task. config = new TaskConfig ()
123
+ task. workDir = Paths . get(' /work/path' )
124
+ task. name = ' array job'
125
+ def taskArray = Mock (TaskArrayRun ) {
126
+ config >> new TaskConfig ()
127
+ name >> task. name
128
+ getArraySize() >> 5
129
+ workDir >> task. workDir
130
+ }
131
+ taskArray. config. time = ' 01:00:00'
132
+
133
+ then :
134
+ executor. getHeaders(taskArray) == '''
135
+ #PJM -N nf-array_job
136
+ #PJM -L elapse=01:00:00
137
+ #PJM -j
138
+ #PJM -S
99
139
'''
100
140
.stripIndent(). leftTrim()
101
141
}
102
- /*
142
+
103
143
def testWorkDirWithBlanks () {
104
144
105
145
setup :
@@ -122,16 +162,15 @@ class TcsExecutorTest extends Specification {
122
162
task. config. time = ' 00:10:00'
123
163
then :
124
164
executor. getHeaders(task) == '''
125
- #PJM -N nf-the_task_name
126
- #PJM -j
127
- #PJM -S
128
- #PJM -L elapse=00:10:00
165
+ #PJM -N nf-the_task_name
166
+ #PJM -L elapse=00:10:00
129
167
#PJM -o "/work/some\\ data/path/.command.log"
168
+ #PJM -j
169
+ #PJM -S
130
170
'''
131
171
.stripIndent(). leftTrim()
132
172
133
173
}
134
- */
135
174
136
175
def testQstatCommand () {
137
176
@@ -169,12 +208,9 @@ class TcsExecutorTest extends Specification {
169
208
170
209
def testQueueStatusCommand () {
171
210
when :
172
- def usr = System . getProperty(' user.name' )
173
211
def exec = [:] as TcsExecutor
174
212
then :
175
- usr
176
- exec. queueStatusCommand(null ) == [' pjstat2' , ' -E' ]
177
- // exec.queueStatusCommand('long') == ['pjstat2','-E']
213
+ exec. queueStatusCommand(null ) == [' pjstat' , ' -E' ]
178
214
}
179
215
180
216
def 'should get array (bulk ) index name and start' () {
@@ -197,39 +233,7 @@ class TcsExecutorTest extends Specification {
197
233
JOB_ID | TASK_INDEX | EXPECTED
198
234
' 1234 ' | 1 | ' 1234 [1 ]'
199
235
' 123456 ' | 2 | ' 123456 [2 ]'
200
- /*
201
- JOB_ID JOB_NAME MD STATUS USER RSCGROUP START_DATE ELAPSE NODE CORE GPU POINT
202
- 3209914 bulk1.sh BU RUN ku40000105 a-batch-low - - - 1 - -
203
- 3209914[1] bulk1.sh BU RUN ku40000105 a-batch-low 2025/06/13 17:53:43 00:00:01 - 1 - 1
204
- */
205
236
}
206
237
207
- /* There is no project option in TCS. (on Genkai and Flow) */
208
- /*
209
- @Unroll
210
- def ' should set tcs account' () {
211
- given:
212
- // task
213
- def task = new TaskRun()
214
- task.workDir = Paths.get(' / work/ dir' )
215
- task.processor = Mock(TaskProcessor)
216
- task.processor.getSession() >> Mock(Session)
217
- task.config = Mock(TaskConfig)
218
- and:
219
- def executor = Spy(TcsExecutor)
220
- executor.getJobNameFor(_) >> ' foo'
221
- executor.getName() >> ' tcs'
222
- executor.getSession() >> Mock(Session) { getExecConfigProp(' tcs' , ' account' ,null)>>ACCOUNT }
223
-
224
- when:
225
- def result = executor.getDirectives(task, [])
226
- then:
227
- result == EXPECTED
228
-
229
- where:
230
- ACCOUNT | EXPECTED
231
- null | [' - N' , ' foo' , ' - o' , ' / work/ dir/ . command. log' , ' - j' ]
232
- ' project-123 ' | [' - N' , ' foo' , ' - o' , ' / work/ dir/ . command. log' , ' - j' ]
233
- }
234
- */
235
238
}
239
+
0 commit comments