Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autoicon
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
w2w
autoicon
Commits
6e918a4e
Commit
6e918a4e
authored
2 years ago
by
Oriol Tintó
Browse files
Options
Downloads
Patches
Plain Diff
Remove files after they have been transferred.
parent
a0aaec0c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
templates/compress.py
+21
-7
21 additions, 7 deletions
templates/compress.py
with
21 additions
and
7 deletions
templates/compress.py
+
21
−
7
View file @
6e918a4e
#!/bin/env python3
#!/bin/env python3
import
glob
import
logging
# Set logging level to info.
logging
.
basicConfig
(
level
=
logging
.
INFO
)
def
main
():
def
main
():
import
os
import
os
...
@@ -11,10 +17,14 @@ def main():
...
@@ -11,10 +17,14 @@ def main():
WORKDIR
=
Path
(
"
%HPCROOTDIR%
"
)
WORKDIR
=
Path
(
"
%HPCROOTDIR%
"
)
STARTDATE
=
"
%SDATE%
"
STARTDATE
=
"
%SDATE%
"
MEMBER
=
"
%MEMBER%
"
MEMBER
=
"
%MEMBER%
"
OUTPUT_FILES
=
"
%simulation.OUTPUT_FILES%
"
output_file_names
=
"
%simulation.OUTPUT_FILES%
"
# Get a list of file names:
output_file_names
=
[
f
for
f
in
output_file_names
.
split
(
"
"
)
if
f
.
strip
()]
# Get a list of files:
output_files
=
[]
OUTPUT_FILES
=
[
f
for
f
in
OUTPUT_FILES
.
split
(
"
"
)
if
f
.
strip
()]
for
file_pattern
in
output_file_names
:
output_files
.
extend
(
glob
.
glob
(
file_pattern
))
# Define rundir
# Define rundir
RUNDIR
=
WORKDIR
/
STARTDATE
/
MEMBER
RUNDIR
=
WORKDIR
/
STARTDATE
/
MEMBER
...
@@ -26,14 +36,18 @@ def main():
...
@@ -26,14 +36,18 @@ def main():
os
.
makedirs
(
OUTPUT_DIR
.
as_posix
())
os
.
makedirs
(
OUTPUT_DIR
.
as_posix
())
# Copy the output files
# Copy the output files
for
file_name
in
OUTPUT_FILES
:
for
file_name
in
output_files
:
source_file_path
=
RUNDIR
/
file_name
source_file_path
=
RUNDIR
/
file_name
destination_file_path
=
OUTPUT_DIR
/
file_name
enstools
.
compression
.
api
.
compress
(
source_file_path
,
output
=
OUTPUT_DIR
,
compression
=
"
lossless
"
)
logging
.
info
(
f
"
Copying
{
file_name
}
"
)
enstools
.
compression
.
api
.
compress
(
source_file_path
,
output
=
destination_file_path
,
compression
=
"
lossless
"
)
# Remove source files
# Remove source files
# if destination_file_path.exists():
if
destination_file_path
.
exists
():
# source_file_path.unlink()
logging
.
info
(
f
"
{
file_name
}
copied to
{
destination_file_path
.
as_posix
()
!r}
. Removing
{
source_file_path
.
as_posix
()
!r}
"
)
source_file_path
.
unlink
()
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
...
...
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