Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
GRID LRT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ASTRON SDC
GRID LRT
Commits
9159f365
Commit
9159f365
authored
Jul 22, 2020
by
Frits Sweijen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "modified such that it runs on spider"
This reverts commit
9f12ae35
.
parent
9f12ae35
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
21 deletions
+20
-21
GRID_LRT/__init__.py
GRID_LRT/__init__.py
+7
-0
GRID_LRT/application/submit.py
GRID_LRT/application/submit.py
+7
-13
GRID_LRT/auth/grid_credentials.py
GRID_LRT/auth/grid_credentials.py
+4
-6
GRID_LRT/data/launchers/run_remote_sandbox.sh
GRID_LRT/data/launchers/run_remote_sandbox.sh
+2
-2
No files found.
GRID_LRT/__init__.py
View file @
9159f365
...
...
@@ -5,6 +5,13 @@ import socket
from
subprocess
import
call
,
Popen
,
PIPE
,
STDOUT
if
sys
.
version_info
[
0
:
2
]
!=
(
2
,
6
):
from
subprocess
import
check_output
from
subprocess
import
Popen
class
SafePopen
(
Popen
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
if
sys
.
version_info
.
major
==
3
:
kwargs
[
'encoding'
]
=
'utf8'
return
super
(
SafePopen
,
self
).
__init__
(
*
args
,
**
kwargs
)
__all__
=
[
"storage"
,
'auth'
,
"application"
,
"Staging"
,
'token'
]
...
...
GRID_LRT/application/submit.py
View file @
9159f365
...
...
@@ -18,12 +18,7 @@ import tempfile
from
GRID_LRT.auth.get_picas_credentials
import
picas_cred
as
pc
import
GRID_LRT
from
GRID_LRT.auth
import
grid_credentials
class
SafePopen
(
Popen
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
if
sys
.
version_info
.
major
==
3
:
kwargs
[
'encoding'
]
=
'utf8'
return
super
(
SafePopen
,
self
).
__init__
(
*
args
,
**
kwargs
)
from
GRID_LRT
import
SafePopen
#class job_launcher(object):
# """Generic Job Launcher
...
...
@@ -376,21 +371,20 @@ class SpiderLauncher(JdlLauncher):
if
not
os
.
path
.
exists
(
self
.
launch_file
):
raise
IOError
(
"Launch file doesn't exist! "
+
self
.
launch_file
)
slurmfile
=
'#!/usr/bin/env bash
\n
'
slurmfile
+=
'#SBATCH --nodes=1 --ntasks 1 --cpus-per-task={ncpu:d} -p {queue:s} --array 1-{njobs:d}%{concurrent:d} --output=job-%A_%a.out --error=job-%A_%a.err'
if
self
.
wholenodes
:
slurmfile
+=
'#SBATCH --exclusive --nodes=1 --ntasks 1--cpus-per-task={ncpu:d} -p {queue:s} --array 1-{njobs:d}%{concurrent:d} --output=spiderjob-%A_%a.out --error=spiderjob-%A_%a.err
\n
'
else
:
slurmfile
+=
'#SBATCH --nodes=1 --ntasks 1 --cpus-per-task={ncpu:d} -p {queue:s} --array 1-{njobs:d}%{concurrent:d} --output=spiderjob-%A_%a.out --error=spiderjob-%A_%a.err
\n
'
slurmfile
+=
" "
.
join
(
slurmfile
,
'--exclusive'
)
slurmfile
+=
'
\n
'
slurmfile
+=
"""
echo Job landed on $(hostname)
JOBDIR=$(mktemp -d -p $TMPDIR)
cd $TMPDIR
JOBDIR=$TMPDIR
export JOBDIR
echo Created job directory $JOBDIR
cd $JOBDIR
{launcher:s} {db:s} {usr:s} {pw:s} {tt:s}
"""
slurmfile
=
slurmfile
.
format
(
ncpu
=
int
(
self
.
ncpu
),
queue
u
=
str
(
self
.
queue
),
slurmfile
=
slurmfile
.
format
(
ncpu
=
int
(
self
.
ncpu
),
queue
=
str
(
self
.
queue
),
njobs
=
self
.
numjobs
,
concurrent
=
self
.
parameter_step
,
launcher
=
str
(
self
.
launch_file
),
...
...
GRID_LRT/auth/grid_credentials.py
View file @
9159f365
...
...
@@ -4,15 +4,14 @@ activated
"""
import
subprocess
from
functools
import
wraps
from
GRID_LRT
import
SafePopen
def
check_uberftp
():
"""Checks if the gfal-ls executable
exists on the system. Returns True if it exists
:returns: bool"""
process
=
subprocess
.
Popen
([
'which'
,
'gfal-ls'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
encoding
=
'utf8'
)
process
=
SafePopen
([
'which'
,
'gfal-ls'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
output
=
process
.
communicate
()
if
output
[
0
]
==
''
and
output
[
1
]
==
''
:
return
False
...
...
@@ -26,11 +25,10 @@ def grid_credentials_enabled():
This requires gfal-ls!"""
if
not
check_uberftp
():
return
False
process
=
subprocess
.
Popen
([
process
=
Safe
Popen
([
'gfal-ls'
,
'-l'
,
'gsiftp://gridftp.grid.sara.nl:2811/pnfs/grid.sara.nl/data/lofar/user/sksp/diskonly'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
encoding
=
'utf8'
)
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
res
=
process
.
communicate
()
if
type
(
res
[
1
])
==
bytes
:
error
=
res
[
1
].
decode
(
'utf8'
)
...
...
GRID_LRT/data/launchers/run_remote_sandbox.sh
View file @
9159f365
...
...
@@ -20,9 +20,9 @@ export PICAS_API_VERSION=$(curl -X GET https://"$2":"$3"@picas-lofar.grid.surfsa
set
-x
if
type
git &> /dev/null
then
git clone https://git
hub.com/apmechev
/GRID_PiCaS_Launcher.git p_tools_git
git clone https://git
.astron.nl/astron-sdc
/GRID_PiCaS_Launcher.git p_tools_git
cd
p_tools_git
||
exit
-100
git checkout
v
"
$PICAS_API_VERSION
"
git checkout
"
$PICAS_API_VERSION
"
git describe
cd
../
||
exit
-100
else
#move this to testpy3
...
...
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