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
56d7f629
Commit
56d7f629
authored
6 years ago
by
Gary Ruben
Browse files
Options
Downloads
Patches
Plain Diff
Added some stdout logging functionality
parent
81d63459
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
asci_to_vault.py
+22
-2
22 additions, 2 deletions
asci_to_vault.py
with
22 additions
and
2 deletions
asci_to_vault.py
+
22
−
2
View file @
56d7f629
...
...
@@ -7,12 +7,14 @@ for details on how to do this between a Monash Linux machine and ASCI.
"""
import
os
import
sys
import
warnings
from
dataclasses
import
dataclass
import
pathlib
import
subprocess
import
pickle
import
pprint
import
time
# This isn't suppressing the warnings that fabric is generating; we need to
...
...
@@ -30,8 +32,10 @@ KERNEL_CHECKSUM=$(cpio --to-stdout -i kernel.fat16 < archive.cpio | sha256sum |
"""
READ_PICKLE_FILE
=
False
READ_PICKLE_FILE
=
True
PICKLE_FILENAME
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
tree_state.pickle
'
)
EXPERIMENT_NAME
=
"
13660a
"
PICKLE_FILENAME
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
tree_state.pickle
"
)
timestamp
=
time
.
strftime
(
"
%Y-%m-%d-%H%M%S
"
)
LOG_FILENAME
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
f
"
{
EXPERIMENT_NAME
}
-
{
timestamp
}
.log
"
)
REMOTE_LOGIN
=
"
gary.ruben@monash.edu@sftp.synchrotron.org.au
"
# SRC_PATH = "/data/13660a/asci/input"
SRC_PATH
=
"
/data/13660a/asci/output/tar_test
"
...
...
@@ -47,6 +51,20 @@ class Node:
processed
:
bool
=
False
# True iff a node transfer completes
class
Logger
(
object
):
def
__init__
(
self
):
self
.
terminal
=
sys
.
stdout
self
.
log
=
open
(
LOG_FILENAME
,
"
a
"
)
def
write
(
self
,
message
):
self
.
terminal
.
write
(
message
)
self
.
log
.
write
(
message
)
def
flush
(
self
):
self
.
terminal
.
flush
()
self
.
log
.
flush
()
def
tar_and_send_directory
(
node
):
"""
Sends all files in the node.src directory to the node.dest directory
across an ssh connection using the cpio command to tar the files into a
...
...
@@ -107,6 +125,8 @@ def tar_and_send_directory(node):
node
.
processed
=
True
if
__name__
==
"
__main__
"
:
sys
.
stdout
=
Logger
()
if
not
READ_PICKLE_FILE
:
# Get the directory tree from remote server as a list
with
Connection
(
REMOTE_LOGIN
)
as
c
:
...
...
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