Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
etf
jess
Commits
0812bc5a
Commit
0812bc5a
authored
Nov 24, 2021
by
Marian Babik
Browse files
added job credentials info
parent
8eb6b503
Changes
2
Hide whitespace changes
Inline
Side-by-side
bin/check_js
View file @
0812bc5a
...
...
@@ -359,10 +359,17 @@ def etf_log():
def
etf_job_details
():
if
app
.
job
.
ts_job_end
:
etf_log
()
print
(
'=== Job JDL:'
)
print
(
'=== Credentials:'
)
if
app
.
job
.
proxy_details
:
print
(
'x509:'
)
print
(
app
.
job
.
proxy_details
)
if
app
.
job
.
token_details
:
print
(
'scitoken:'
)
print
(
app
.
job
.
token_details
)
print
(
'=== Job description:'
)
print
(
app
.
job
.
jdl
)
# print(app.job.proxy)
print
(
'=== Job submission:'
)
print
(
'=== Job submission
command
:'
)
print
(
app
.
job
.
submit_cmd
)
print
(
app
.
job
.
submit_out
)
if
app
.
job
.
log
:
...
...
jess/jobs.py
View file @
0812bc5a
...
...
@@ -6,6 +6,10 @@ import os.path
import
pickle
import
logging
import
time
import
base64
import
nap.core
try
:
from
urllib.parse
import
urlparse
except
ImportError
:
...
...
@@ -34,7 +38,9 @@ class Job(object):
self
.
wd
=
None
self
.
backend
=
None
self
.
proxy
=
None
self
.
proxy_details
=
None
self
.
token
=
None
self
.
token_details
=
None
self
.
jdl
=
None
self
.
payload
=
None
self
.
job_file
=
None
...
...
@@ -130,6 +136,32 @@ class JMI(object):
if
self
.
_proxy
:
os
.
environ
[
'X509_USER_PROXY'
]
=
self
.
_proxy
@
staticmethod
def
proxy_info
(
proxy
):
if
not
proxy
:
return
''
try
:
ret_code
,
cmd_out
=
nap
.
core
.
sub_process
(
'/bin/voms-proxy-info --subject --fqan --file {}'
.
format
(
proxy
),
mode
=
'pexpect'
)
if
ret_code
!=
nap
.
core
.
SUBPROCESS_FAILED
:
return
cmd_out
except
Exception
as
e
:
return
'Failed to run voms-proxy-info {}'
.
format
(
e
)
@
staticmethod
def
token_info
(
token_file
):
if
not
token_file
:
return
''
try
:
with
open
(
token_file
,
'rb'
)
as
tf
:
token
=
tf
.
read
()
if
'.'
in
token
:
token
=
token
.
split
(
"."
)[
1
]
padding
=
4
-
(
len
(
token
)
%
4
)
return
base64
.
b64decode
(
token
+
padding
*
"="
)
except
Exception
as
e
:
return
'Failed to get token info {}'
.
format
(
e
)
def
submit
(
self
):
# submits new job and adds it to the jobs file
jess_log
.
debug
(
' submitting new job'
)
...
...
@@ -178,7 +210,9 @@ class JMI(object):
# meta
job
.
backend
=
self
.
_backend
job
.
proxy
=
self
.
_proxy
job
.
proxy_details
=
JMI
.
proxy_info
(
self
.
_proxy
)
job
.
token
=
self
.
_token
job
.
token_details
=
JMI
.
token_info
(
self
.
_token
)
job
.
jdl
=
self
.
_jdl
job
.
payload
=
self
.
_payload
job
.
resource
=
self
.
_resource
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment