Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vospace-transfer-service
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VOSpace INAF
vospace-transfer-service
Commits
1908dacb
Commit
1908dacb
authored
Mar 5, 2021
by
Cristiano Urban
Browse files
Options
Downloads
Patches
Plain Diff
Minor changes, some tests.
Signed-off-by:
Cristiano Urban
<
cristiano.urban@inaf.it
>
parent
3132dd69
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
transfer_service/retrieve_executor.py
+20
-1
20 additions, 1 deletion
transfer_service/retrieve_executor.py
transfer_service/tape_client.py
+11
-0
11 additions, 0 deletions
transfer_service/tape_client.py
with
31 additions
and
1 deletion
transfer_service/retrieve_executor.py
+
20
−
1
View file @
1908dacb
...
...
@@ -7,6 +7,7 @@ from db_connector import DbConnector
from
tape_client
import
TapeClient
from
task_executor
import
TaskExecutor
class
RetrieveExecutor
(
TaskExecutor
):
def
__init__
(
self
):
...
...
@@ -29,9 +30,26 @@ class RetrieveExecutor(TaskExecutor):
self
.
nodeList
=
[]
super
(
RetrieveExecutor
,
self
).
__init__
()
def
retrieveData
(
self
):
def
prepareData
(
self
):
fileList
=
[]
self
.
dbConn
.
connect
()
self
.
dbConn
.
setPhase
(
self
.
jobId
,
"
EXECUTING
"
)
for
vospacePath
in
self
.
nodeList
:
[
srcPath
,
storageType
,
username
,
osRelPath
]
=
self
.
dbConn
.
getOSPath
(
vospacePath
)
if
storageType
==
"
cold
"
:
if
os
.
path
.
isdir
(
srcPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
srcPath
):
for
f
in
files
:
fileList
.
append
(
os
.
path
.
join
(
root
,
f
))
else
:
fileList
.
append
(
srcPath
)
self
.
dbConn
.
disconnect
()
if
fileList
:
self
.
tapeClient
.
recall
(
fileList
)
def
retrieveData
(
self
):
self
.
dbConn
.
connect
()
#self.dbConn.setPhase(self.jobId, "EXECUTING")
for
vospacePath
in
self
.
nodeList
:
[
srcPath
,
storageType
,
username
,
osRelPath
]
=
self
.
dbConn
.
getOSPath
(
vospacePath
)
osRelParentPath
=
os
.
path
.
dirname
(
osRelPath
)
...
...
@@ -90,6 +108,7 @@ class RetrieveExecutor(TaskExecutor):
self
.
jobObj
=
self
.
srcQueue
.
getJob
()
self
.
jobId
=
self
.
jobObj
.
jobId
self
.
nodeList
=
self
.
jobObj
.
jobInfo
[
"
nodeList
"
]
self
.
prepareData
()
result
=
self
.
retrieveData
()
if
result
:
self
.
updateJobStatus
()
...
...
This diff is collapsed.
Click to expand it.
transfer_service/tape_client.py
+
11
−
0
View file @
1908dacb
...
...
@@ -3,6 +3,7 @@ import os
import
paramiko
import
scp
import
sys
import
uuid
from
tape_task
import
TapeTask
...
...
@@ -69,6 +70,16 @@ class TapeClient(object):
sys
.
exit
(
"
FATAL: invalid file/dir.
"
)
self
.
scp
.
close
()
def
recall
(
self
,
fileList
):
#TODO
cmd
=
"
eeadm recall
"
tmp
=
str
(
uuid
.
uuid1
().
hex
)
+
"
.tmp
"
stdin
,
stdout
,
stderr
=
self
.
client
.
exec_command
(
cmd
)
def
recallChecksumFiles
(
self
,
dirName
):
cmd
=
"
find $(dirname
"
+
dirName
+
"
) -type f \( -iname
\"
*-md5sum.txt
\"
\) | eeadm recall
"
stdin
,
stdout
,
stderr
=
self
.
client
.
exec_command
(
cmd
)
# Closes the connection
def
disconnect
(
self
):
self
.
client
.
close
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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
sign in
to comment