Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cromwell-sdk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liugaoling
cromwell-sdk
Commits
18c137d7
Commit
18c137d7
authored
May 30, 2022
by
liugaoling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add work script
parent
55d62004
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
CreateJobRequest.java
...main/java/com/cloudam/cromwell/core/CreateJobRequest.java
+5
-9
JobDescription.java
...main/java/com/cloudam/cromwell/domain/JobDescription.java
+13
-0
No files found.
src/main/java/com/cloudam/cromwell/core/CreateJobRequest.java
View file @
18c137d7
...
...
@@ -64,14 +64,14 @@ public class CreateJobRequest extends CloudamRequest<CreateJobResponse> {
// sbatch -n 1 -c 8 --comment disk:CLOUD_SSD:2700G:s-NV0tQ0PL run_local.sh
// sbatch -n 1 -c 8 -p c-52-2 -q eco cpu.sh
StringBuffer
commandBuffer
=
new
StringBuffer
(
"#!/bin/sh\n"
);
BiConsumer
<
String
,
String
>
stringValidAppend
=
(
key
,
a
gr
s
)
->
{
BiConsumer
<
String
,
String
>
stringValidAppend
=
(
key
,
a
rg
s
)
->
{
if
(
StringUtils
.
isNotBlank
(
key
))
{
commandBuffer
.
append
(
"#SBATCH "
).
append
(
a
gr
s
).
append
(
" "
).
append
(
key
).
append
(
"\n"
);
commandBuffer
.
append
(
"#SBATCH "
).
append
(
a
rg
s
).
append
(
" "
).
append
(
key
).
append
(
"\n"
);
}
};
BiConsumer
<
Integer
,
String
>
intValidAppend
=
(
key
,
a
gr
s
)
->
{
BiConsumer
<
Integer
,
String
>
intValidAppend
=
(
key
,
a
rg
s
)
->
{
if
(
key
!=
null
&&
key
!=
0
)
{
commandBuffer
.
append
(
"#SBATCH "
).
append
(
a
gr
s
).
append
(
" "
).
append
(
key
).
append
(
"\n"
);
commandBuffer
.
append
(
"#SBATCH "
).
append
(
a
rg
s
).
append
(
" "
).
append
(
key
).
append
(
"\n"
);
}
};
stringValidAppend
.
accept
(
jobDescription
.
getName
(),
"-J"
);
...
...
@@ -82,11 +82,7 @@ public class CreateJobRequest extends CloudamRequest<CreateJobResponse> {
intValidAppend
.
accept
(
jobDescription
.
getNtasks
(),
"-n"
);
intValidAppend
.
accept
(
jobDescription
.
getTimeout
(),
"-t"
);
String
workScript
=
jobDescription
.
getEnvs
().
get
(
"cwd"
)
+
"/script"
;
if
(
Os
.
Windows
!=
jobDescription
.
getAutoCluster
().
getOs
())
{
commandBuffer
.
append
(
"dos2unix "
).
append
(
workScript
).
append
(
"\n"
);
}
commandBuffer
.
append
(
"bash "
).
append
(
workScript
).
append
(
"\n"
);
commandBuffer
.
append
(
jobDescription
.
getWorkScript
()).
append
(
"\n"
);
return
commandBuffer
.
toString
();
}
}
src/main/java/com/cloudam/cromwell/domain/JobDescription.java
View file @
18c137d7
...
...
@@ -29,6 +29,11 @@ public class JobDescription {
*/
private
AutoCluster
autoCluster
;
/**
*
*/
private
String
workScript
;
/**
* 环境变量
*/
...
...
@@ -86,6 +91,14 @@ public class JobDescription {
this
.
autoCluster
=
autoCluster
;
}
public
String
getWorkScript
()
{
return
workScript
;
}
public
void
setWorkScript
(
String
workScript
)
{
this
.
workScript
=
workScript
;
}
public
Map
<
String
,
String
>
getEnvs
()
{
return
envs
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment