... | @@ -93,7 +93,7 @@ namespace WsClient |
... | @@ -93,7 +93,7 @@ namespace WsClient |
|
|
|
|
|
private static void CreateAndSubmitTestJob()
|
|
private static void CreateAndSubmitTestJob()
|
|
{
|
|
{
|
|
//each submitted job must contain at least one task
|
|
//each submitted job must contain at least one task
|
|
TaskSpecificationExt testTask = new TaskSpecificationExt();
|
|
TaskSpecificationExt testTask = new TaskSpecificationExt();
|
|
testTask.name = "TestJob";
|
|
testTask.name = "TestJob";
|
|
testTask.minCores = 1; //minimum number of cores required
|
|
testTask.minCores = 1; //minimum number of cores required
|
... | @@ -112,7 +112,7 @@ namespace WsClient |
... | @@ -112,7 +112,7 @@ namespace WsClient |
|
"inputParam", parameterValue = "someStringParam" }
|
|
"inputParam", parameterValue = "someStringParam" }
|
|
};
|
|
};
|
|
|
|
|
|
//create job specification with the task above
|
|
//create job specification with the task above
|
|
JobSpecificationExt testJob = new JobSpecificationExt();
|
|
JobSpecificationExt testJob = new JobSpecificationExt();
|
|
testJob.name = "TestJob"; //job name
|
|
testJob.name = "TestJob"; //job name
|
|
testJob.minCores = 1; //minimum number of cores required
|
|
testJob.minCores = 1; //minimum number of cores required
|
... | @@ -122,7 +122,7 @@ namespace WsClient |
... | @@ -122,7 +122,7 @@ namespace WsClient |
|
testJob.waitingLimit = null; //limit for the waiting time in cluster queue
|
|
testJob.waitingLimit = null; //limit for the waiting time in cluster queue
|
|
testJob.walltimeLimit = 600; //maximum time for job to run (seconds)
|
|
testJob.walltimeLimit = 600; //maximum time for job to run (seconds)
|
|
testJob.clusterNodeTypeId = 7; //Salomon express queue (1h limit)
|
|
testJob.clusterNodeTypeId = 7; //Salomon express queue (1h limit)
|
|
//custom environment variables for the job
|
|
//custom environment variables for the job
|
|
testJob.environmentVariables = new EnvironmentVariableExt[0];
|
|
testJob.environmentVariables = new EnvironmentVariableExt[0];
|
|
//assign created task to job specification
|
|
//assign created task to job specification
|
|
testJob.tasks = new TaskSpecificationExt[] { testTask };
|
|
testJob.tasks = new TaskSpecificationExt[] { testTask };
|
... | @@ -161,13 +161,13 @@ namespace WsClient |
... | @@ -161,13 +161,13 @@ namespace WsClient |
|
long jobId = (long)submittedTestJob.id;
|
|
long jobId = (long)submittedTestJob.id;
|
|
do
|
|
do
|
|
{
|
|
{
|
|
//wait 30s before the next status check
|
|
//wait 30s before the next status check
|
|
System.Threading.Thread.Sleep(30000);
|
|
System.Threading.Thread.Sleep(30000);
|
|
//get info for the job
|
|
//get info for the job
|
|
submittedJob = wsJobManagement.GetCurrentInfoForJob(jobId, sessionCode);
|
|
submittedJob = wsJobManagement.GetCurrentInfoForJob(jobId, sessionCode);
|
|
Console.WriteLine(submittedJob.state);
|
|
Console.WriteLine(submittedJob.state);
|
|
//set offsets for the stdout, stderr, stdprog, stdlog files
|
|
//set offsets for the stdout, stderr, stdprog, stdlog files
|
|
//offsets can be used for the partial download of files
|
|
//offsets can be used for the partial download of files
|
|
List<TaskFileOffsetExt> offsets = new List<TaskFileOffsetExt>();
|
|
List<TaskFileOffsetExt> offsets = new List<TaskFileOffsetExt>();
|
|
foreach (SubmittedTaskInfoExt taskInfo in submittedJob.tasks)
|
|
foreach (SubmittedTaskInfoExt taskInfo in submittedJob.tasks)
|
|
{
|
|
{
|
... | @@ -209,11 +209,11 @@ namespace WsClient |
... | @@ -209,11 +209,11 @@ namespace WsClient |
|
}
|
|
}
|
|
}
|
|
}
|
|
While (submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Submitted
|
|
While (submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Submitted
|
|
|| submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Configuring
|
|
|| submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Configuring
|
|
|| submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Queued
|
|
|| submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Queued
|
|
|| submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Running);
|
|
|| submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Running);
|
|
|
|
|
|
//job computation is done (finished/failed/canceled)
|
|
//job computation is done (finished/failed/canceled)
|
|
submittedJob = wsJobManagement.GetCurrentInfoForJob(jobId, sessionCode);
|
|
submittedJob = wsJobManagement.GetCurrentInfoForJob(jobId, sessionCode);
|
|
// job finished successfully, download result files from the cluster
|
|
// job finished successfully, download result files from the cluster
|
|
if (submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Finished)
|
|
if (submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Finished)
|
... | @@ -226,7 +226,6 @@ namespace WsClient |
... | @@ -226,7 +226,6 @@ namespace WsClient |
|
ft.credentials.username, new PrivateKeyFile(pKeyStream)))
|
|
ft.credentials.username, new PrivateKeyFile(pKeyStream)))
|
|
{
|
|
{
|
|
scpClient.Connect();
|
|
scpClient.Connect();
|
|
|
|
|
|
// changed result files
|
|
// changed result files
|
|
string[] changedFiles = wsFileTransfer.ListChangedFilesForJob(
|
|
string[] changedFiles = wsFileTransfer.ListChangedFilesForJob(
|
|
jobId, sessionCode);
|
|
jobId, sessionCode);
|
... | @@ -240,7 +239,7 @@ namespace WsClient |
... | @@ -240,7 +239,7 @@ namespace WsClient |
|
}
|
|
}
|
|
wsFileTransfer.EndFileTransfer(jobId, ft, sessionCode);
|
|
wsFileTransfer.EndFileTransfer(jobId, ft, sessionCode);
|
|
}
|
|
}
|
|
// job failed or was canceled
|
|
// job failed or was canceled
|
|
else if (submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Failed
|
|
else if (submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Failed
|
|
|| submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Canceled)
|
|
|| submittedJob.state == WsClient.test_JobManagementWs.JobStateExt.Canceled)
|
|
{
|
|
{
|
... | @@ -261,3 +260,63 @@ namespace WsClient |
... | @@ -261,3 +260,63 @@ namespace WsClient |
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
|
|
## Sample Template Output
|
|
|
|
|
|
|
|
```
|
|
|
|
Authenticating user [testuser]...
|
|
|
|
Auth OK (Session GUID: 4a5d7017-1992-45b1-8b07-43cf5d421f50)
|
|
|
|
Created job ID 71.
|
|
|
|
Uploading file: someInputFile1.txt
|
|
|
|
File uploaded.
|
|
|
|
Uploading file: someInputFile2.txt
|
|
|
|
File uploaded.
|
|
|
|
Submitted job ID: 71
|
|
|
|
Queued
|
|
|
|
File: StandardErrorFile, console_Stderr
|
|
|
|
TaskInfoId: 71
|
|
|
|
Offset: 0
|
|
|
|
Content:
|
|
|
|
File: StandardOutputFile, console_Stdout
|
|
|
|
TaskInfoId: 71
|
|
|
|
Offset: 0
|
|
|
|
Content: Input param: someStringParam
|
|
|
|
Iteration: 01
|
|
|
|
|
|
|
|
Running
|
|
|
|
File: StandardErrorFile, console_Stderr
|
|
|
|
TaskInfoId: 71
|
|
|
|
Offset: 0
|
|
|
|
Content:
|
|
|
|
File: StandardOutputFile, console_Stdout
|
|
|
|
TaskInfoId: 71
|
|
|
|
Offset: 0
|
|
|
|
Content: Input param: someStringParam
|
|
|
|
Iteration: 01
|
|
|
|
Iteration: 02
|
|
|
|
|
|
|
|
Finished
|
|
|
|
File: StandardErrorFile, console_Stderr
|
|
|
|
TaskInfoId: 71
|
|
|
|
Offset: 0
|
|
|
|
Content:
|
|
|
|
File: StandardOutputFile, console_Stdout
|
|
|
|
TaskInfoId: 71
|
|
|
|
Offset: 0
|
|
|
|
Content: Input param: someStringParam
|
|
|
|
Iteration: 01
|
|
|
|
Iteration: 02
|
|
|
|
Iteration: 03
|
|
|
|
Iteration: 04
|
|
|
|
Iteration: 05
|
|
|
|
Iteration: 06
|
|
|
|
Iteration: 07
|
|
|
|
Iteration: 08
|
|
|
|
Iteration: 09
|
|
|
|
Iteration: 10
|
|
|
|
|
|
|
|
Downloading file: /resultFile.txt
|
|
|
|
Downloading file: /console_Stdout
|
|
|
|
Downloading file: /console_Stderr
|
|
|
|
Press any key to continue . . .
|
|
|
|
``` |
|
|
|
\ No newline at end of file |