Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hattivatti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GDP-Public
hattivatti
Commits
14edcb7d
Commit
14edcb7d
authored
1 year ago
by
Benjamin Wingfield
Browse files
Options
Downloads
Patches
Plain Diff
run sbatch
parent
2e245fb4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/db/job/update.rs
+21
-1
21 additions, 1 deletion
src/db/job/update.rs
src/main.rs
+1
-2
1 addition, 2 deletions
src/main.rs
src/slurm/job.rs
+4
-1
4 additions, 1 deletion
src/slurm/job.rs
with
26 additions
and
4 deletions
src/db/job/update.rs
+
21
−
1
View file @
14edcb7d
use
std
::
process
::
Command
;
use
log
::
info
;
use
rusqlite
::
Connection
;
use
crate
::
db
::
job
::
state
::
JobState
;
use
crate
::
slurm
::
job
::
JobPath
;
use
crate
::
slurm
::
job_request
::
JobRequest
;
impl
JobRequest
{
...
...
@@ -10,8 +12,11 @@ impl JobRequest {
self
.update
(
conn
,
state
);
}
pub
fn
submit
(
&
self
,
conn
:
&
Connection
)
{
pub
fn
submit
(
&
self
,
conn
:
&
Connection
,
job
:
JobPath
)
{
let
job_id
=
self
.run_sbatch
(
job
);
info!
(
"SLURM job id: {job_id}"
);
let
state
=
JobState
::
Submitted
;
// todo: store SLURM job id in table too
self
.update
(
conn
,
state
);
}
...
...
@@ -26,4 +31,19 @@ impl JobRequest {
&
[(
id
.as_str
())],
)
.expect
(
"Update job status to {col}"
);
}
fn
run_sbatch
(
&
self
,
job_path
:
JobPath
)
->
String
{
let
wd
=
job_path
.path
.parent
()
.unwrap
();
let
output
=
Command
::
new
(
"sbatch"
)
.arg
(
"--parsable"
)
.arg
(
"--output"
)
.arg
(
wd
)
.arg
(
"--error"
)
.arg
(
wd
)
.arg
(
job_path
.path
)
.output
()
.expect
(
"sbatch"
);
String
::
from_utf8
(
output
.stdout
)
.expect
(
"job id"
)
}
}
This diff is collapsed.
Click to expand it.
src/main.rs
+
1
−
2
View file @
14edcb7d
...
...
@@ -75,8 +75,7 @@ async fn main() {
let
job_path
=
job
.create
(
&
wd
);
if
!
args
.dry_run
{
job
.stage
(
&
conn
);
// todo: sbatch this path
info!
(
"{}"
,
job_path
.path
.display
())
job
.submit
(
&
conn
,
job_path
);
}
else
{
info!
(
"--dry-run set, not submitting job to slurm"
);
}
...
...
This diff is collapsed.
Click to expand it.
src/slurm/job.rs
+
4
−
1
View file @
14edcb7d
...
...
@@ -2,6 +2,7 @@ use std::{fs, io};
use
std
::
fs
::
OpenOptions
;
use
std
::
io
::
Write
;
use
std
::
path
::{
Path
,
PathBuf
};
use
std
::
process
::
Command
;
use
chrono
::
Utc
;
use
log
::{
info
,
warn
};
...
...
@@ -11,7 +12,9 @@ use tinytemplate::TinyTemplate;
use
crate
::
slurm
::
job_request
::{
JobRequest
,
NxfParamsFile
,
PipelineParam
,
TargetGenome
};
use
crate
::
WorkingDirectory
;
pub
struct
JobPath
{
pub
path
:
PathBuf
}
pub
struct
JobPath
{
pub
path
:
PathBuf
,
}
impl
JobRequest
{
pub
fn
create
(
&
self
,
wd
:
&
WorkingDirectory
)
->
JobPath
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment