Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
remote_tree_to_local_tars
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
Releases
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gary Ruben
remote_tree_to_local_tars
Commits
eb5f5176
Commit
eb5f5176
authored
6 years ago
by
Gary Ruben
Browse files
Options
Downloads
Patches
Plain Diff
improved find command to avoid leading ./ on paths
parent
693b3525
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
asci_to_vault.py
+6
-6
6 additions, 6 deletions
asci_to_vault.py
with
6 additions
and
6 deletions
asci_to_vault.py
+
6
−
6
View file @
eb5f5176
...
...
@@ -52,7 +52,7 @@ import time
from
fabric
import
Connection
READ_PICKLE_FILE
=
Fals
e
READ_PICKLE_FILE
=
Tru
e
EXPERIMENT_NAME
=
"
13660b
"
PICKLE_FILENAME
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
tree_state.pickle
"
)
timestamp
=
time
.
strftime
(
"
%Y-%m-%d-%H%M%S
"
)
...
...
@@ -107,7 +107,7 @@ def tar_and_send_directory(node):
# add check to make sure connection is working
with
Connection
(
REMOTE_LOGIN
)
as
c
:
files
=
c
.
run
(
f
'
cd
{
node
.
src
}
; find -
type f -maxdepth 1
'
,
rf
"
cd
{
node
.
src
}
; find -
maxdepth 1 -type f -printf
'
%f\n
'"
,
echo
=
True
)
files
=
files
.
stdout
.
strip
()
...
...
@@ -115,7 +115,7 @@ def tar_and_send_directory(node):
# print(f'Connection failed on {node.src}')
# node.error = "Connection failure on initial file find"
# return
node
.
count
=
files
.
count
(
'
/
'
)
node
.
count
=
files
.
count
(
'
\n
'
)
print
(
f
'
Node:
{
node
.
src
}
, file count:
{
node
.
count
}
'
)
if
node
.
count
==
0
:
...
...
@@ -125,7 +125,7 @@ def tar_and_send_directory(node):
# Only one file. No need to tar. Just copy unchanged.
output
=
subprocess
.
run
(
f
"
ssh
{
REMOTE_LOGIN
}
'
cd
{
node
.
src
}
;
"
f
"
find -
type f -
maxdepth 1 | cpio -o
'
|
"
r
f
"
find -maxdepth 1
-type f -printf
'
%f\n
'
| cpio -o
'
|
"
f
"
cat >
{
node
.
dest
}
/
{
files
}
"
,
shell
=
True
,
check
=
True
...
...
@@ -143,8 +143,8 @@ def tar_and_send_directory(node):
output
=
subprocess
.
run
(
f
"
ssh
{
REMOTE_LOGIN
}
'
cd
{
node
.
src
}
;
"
f
"
find
-type f
-maxdepth 1 -
print0 | cpio -o -H ustar -0
'
|
"
f
"
cat >
{
node
.
dest
}
/
{
filename
}
.tar
"
,
r
f
"
find -maxdepth 1 -
type f -printf
'
%f\n
'
-print0
|
"
f
"
cpio -o -H ustar -0
'
|
cat >
{
node
.
dest
}
/
{
filename
}
.tar
"
,
shell
=
True
,
check
=
True
)
...
...
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
register
or
sign in
to comment