@@ -25,14 +25,18 @@ function communicatingSubmitFcn(cluster, job, environmentProperties)
25
25
26
26
% Get the correct quote and file separator for the Cluster OS.
27
27
% This check is unnecessary in this file because we explicitly
28
- % checked that the ClusterOsType is unix. This code is an example
28
+ % checked that the clusterOS is unix. This code is an example
29
29
% of how to deal with clusters that can be unix or pc.
30
30
if strcmpi(clusterOS , ' unix' )
31
31
quote = ' '' ' ;
32
32
fileSeparator = ' /' ;
33
+ scriptExt = ' .sh' ;
34
+ shellCmd = ' sh' ;
33
35
else
34
36
quote = ' "' ;
35
37
fileSeparator = ' \' ;
38
+ scriptExt = ' .bat' ;
39
+ shellCmd = ' cmd /c' ;
36
40
end
37
41
38
42
if isprop(cluster .AdditionalProperties , ' ClusterHost' )
@@ -131,7 +135,7 @@ function communicatingSubmitFcn(cluster, job, environmentProperties)
131
135
quotedLogFile = sprintf(' %s%s%s ' , quote , logFile , quote );
132
136
dctSchedulerMessage(5 , ' %s : Using %s as log file' , currFilename , quotedLogFile );
133
137
134
- jobName = sprintf(' Job %d ' , job .ID );
138
+ jobName = sprintf(' MATLAB_R %s _Job %d ' , version( ' -release ' ) , job .ID );
135
139
136
140
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
137
141
%% CUSTOMIZATION MAY BE REQUIRED %%
@@ -144,29 +148,32 @@ function communicatingSubmitFcn(cluster, job, environmentProperties)
144
148
end
145
149
commonSubmitArgs = getCommonSubmitArgs(cluster );
146
150
additionalSubmitArgs = strtrim(sprintf(' %s %s ' , additionalSubmitArgs , commonSubmitArgs ));
147
-
148
- % Extension to use for scripts
149
- scriptExt = ' .sh ' ;
151
+ if validatedPropValue( cluster . AdditionalProperties , ' DisplaySubmitArgs ' , ' logical ' , false )
152
+ fprintf( ' Submit arguments: %s\n ' , additionalSubmitArgs );
153
+ end
150
154
151
155
% Path to the submit script, to submit the Grid Engine job using qsub
152
- localSubmitScriptPath = [tempname( localJobDirectory ) scriptExt ] ;
153
- [ ~ , submitScriptName , submitScriptExt ] = fileparts( localSubmitScriptPath );
154
- submitScriptPathOnCluster = sprintf(' %s%s%s%s ' , jobDirectoryOnCluster , fileSeparator , submitScriptName , submitScriptExt );
156
+ submitScriptName = sprintf( ' submitScript %s ' , scriptExt ) ;
157
+ localSubmitScriptPath = sprintf( ' %s%s%s ' , localJobDirectory , fileSeparator , submitScriptName );
158
+ submitScriptPathOnCluster = sprintf(' %s%s%s ' , jobDirectoryOnCluster , fileSeparator , submitScriptName );
155
159
quotedSubmitScriptPathOnCluster = sprintf(' %s%s%s ' , quote , submitScriptPathOnCluster , quote );
156
160
157
161
% Path to the environment wrapper, which will set the environment variables
158
162
% for the job then execute the job wrapper
159
- localEnvScriptPath = [tempname( localJobDirectory ) scriptExt ] ;
160
- [ ~ , envScriptName , envScriptExt ] = fileparts( localEnvScriptPath );
161
- envScriptPathOnCluster = sprintf(' %s%s%s%s ' , jobDirectoryOnCluster , fileSeparator , envScriptName , envScriptExt );
163
+ envScriptName = sprintf( ' environmentWrapper %s ' , scriptExt ) ;
164
+ localEnvScriptPath = sprintf( ' %s%s%s ' , localJobDirectory , fileSeparator , envScriptName );
165
+ envScriptPathOnCluster = sprintf(' %s%s%s ' , jobDirectoryOnCluster , fileSeparator , envScriptName );
162
166
quotedEnvScriptPathOnCluster = sprintf(' %s%s%s ' , quote , envScriptPathOnCluster , quote );
163
167
168
+ % Create the scripts to submit a Grid Engine job.
169
+ % These will be created in the job directory.
170
+ dctSchedulerMessage(5 , ' %s : Generating scripts for job %d ' , currFilename , job .ID );
164
171
createEnvironmentWrapper(localEnvScriptPath , quotedWrapperPath , variables );
165
172
createSubmitScript(localSubmitScriptPath , jobName , quotedLogFile , ...
166
173
quotedEnvScriptPathOnCluster , additionalSubmitArgs );
167
174
168
175
% Create the command to run on the cluster
169
- commandToRun = sprintf(' sh %s ' , quotedSubmitScriptPathOnCluster );
176
+ commandToRun = sprintf(' %s %s ' , shellCmd , quotedSubmitScriptPathOnCluster );
170
177
171
178
if ~cluster .HasSharedFilesystem
172
179
% Start the mirror to copy all the job files over to the cluster
@@ -239,7 +246,7 @@ function communicatingSubmitFcn(cluster, job, environmentProperties)
239
246
if verLessThan(' matlab' , ' 9.7' ) % schedulerID stored in job data
240
247
jobData.ClusterJobIDs = jobIDs ;
241
248
else % schedulerID on task since 19b
242
- if numel (job .Tasks ) == 1
249
+ if isscalar (job .Tasks )
243
250
schedulerIDs = jobIDs{1 };
244
251
else
245
252
schedulerIDs = repmat(jobIDs , size(job .Tasks ));
0 commit comments