Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csppfetch
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
cspp_geo
csppfetch
Commits
f7b4eb8d
Commit
f7b4eb8d
authored
3 years ago
by
Alan De Smet
Browse files
Options
Downloads
Patches
Plain Diff
Output to stdout not stderr
This matches the old aitf-mirror behavior (and matching tests)
parent
9af23f39
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
example/aitf-data-for-run
+5
-5
5 additions, 5 deletions
example/aitf-data-for-run
example/aitf-update-cache
+6
-5
6 additions, 5 deletions
example/aitf-update-cache
example/aitf/progress.py
+3
-3
3 additions, 3 deletions
example/aitf/progress.py
with
14 additions
and
13 deletions
example/aitf-data-for-run
+
5
−
5
View file @
f7b4eb8d
...
...
@@ -81,9 +81,9 @@ def hack_oisst_preliminary_filename(filename):
def
yes_download_report
(
name
,
stats
):
sys
.
std
err
.
write
(
name
+
"
\n
"
)
sys
.
std
out
.
write
(
name
+
"
\n
"
)
for
x
in
stats
.
report
():
sys
.
std
err
.
write
(
"
"
+
x
+
"
\n
"
)
sys
.
std
out
.
write
(
"
"
+
x
+
"
\n
"
)
def
no_download_report
(
name
,
stats
):
pass
...
...
@@ -116,21 +116,21 @@ def main():
try
:
if
args
.
want_progress
:
sys
.
std
err
.
write
(
"
Acquiring SST
\n
"
)
if
args
.
want_progress
:
sys
.
std
out
.
write
(
"
Acquiring SST
\n
"
)
sststats
=
aitf
.
ancil
.
SST
.
download_for_time
(
args
.
scan_time
,
args
.
cache
,
do_download
=
do_download
,
progress
=
progress
)
sst_files
=
sststats
.
all_files
()
log_download_report
(
"
SST Download Summary
"
,
sststats
)
# using SST instead of GFS to show that
# DownloadStatistics are interchangable.
if
args
.
want_progress
:
sys
.
std
err
.
write
(
"
Acquiring GFS
\n
"
)
if
args
.
want_progress
:
sys
.
std
out
.
write
(
"
Acquiring GFS
\n
"
)
gfsstats
=
aitf
.
ancil
.
GFS
.
download_for_time
(
args
.
scan_time
,
args
.
cache
,
do_download
=
do_download
,
progress
=
progress
)
gfs_files
=
gfsstats
.
all_files
()
log_download_report
(
"
GFS Download Summary
"
,
gfsstats
)
log_download_report
(
"
Total Download Summary
"
,
sststats
+
gfsstats
)
if
args
.
want_progress
:
sys
.
std
err
.
write
(
"
Symbolically linking into place
\n
"
)
if
args
.
want_progress
:
sys
.
std
out
.
write
(
"
Symbolically linking into place
\n
"
)
all_files
=
list
(
sst_files
)
+
list
(
gfs_files
)
for
destination
in
args
.
destination
:
for
file
in
all_files
:
...
...
This diff is collapsed.
Click to expand it.
example/aitf-update-cache
+
6
−
5
View file @
f7b4eb8d
...
...
@@ -93,9 +93,9 @@ def parse_args():
def
yes_download_report
(
name
,
stats
):
sys
.
std
err
.
write
(
name
+
"
\n
"
)
sys
.
std
out
.
write
(
name
+
"
\n
"
)
for
x
in
stats
.
report
():
sys
.
std
err
.
write
(
"
"
+
x
+
"
\n
"
)
sys
.
std
out
.
write
(
"
"
+
x
+
"
\n
"
)
def
no_download_report
(
name
,
stats
):
pass
...
...
@@ -219,9 +219,10 @@ def main():
from
datetime
import
datetime
expiration
=
(
datetime
.
now
()
-
args
.
expiration
).
timestamp
()
stats
=
delete_old_files
(
args
.
dir
,
expiration
)
logging
.
summary
(
'
Expiring Old Data Summary
'
)
logging
.
summary
(
f
'
Removed
{
stats
.
num_deleted
}
files totaling
{
stats
.
size_deleted
}
bytes
'
)
logging
.
summary
(
f
'
Kept
{
stats
.
num_kept
}
files totaling
{
stats
.
size_kept
}
bytes
'
)
if
args
.
want_summary
:
sys
.
stdout
.
write
(
'
Expiring Old Data Summary
\n
'
)
sys
.
stdout
.
write
(
f
'
Removed
{
stats
.
num_deleted
}
files totaling
{
stats
.
size_deleted
}
bytes
\n
'
)
sys
.
stdout
.
write
(
f
'
Kept
{
stats
.
num_kept
}
files totaling
{
stats
.
size_kept
}
bytes
\n
'
)
return
0
...
...
This diff is collapsed.
Click to expand it.
example/aitf/progress.py
+
3
−
3
View file @
f7b4eb8d
...
...
@@ -28,15 +28,15 @@ human_bytes = csppfetch.human_bytes
class
Progress
(
csppfetch
.
Progress
):
def
start_attempt
(
self
,
stats
):
sys
.
std
err
.
write
(
f
"
Attempt
{
stats
.
current_attempt
}
out of maximum
{
stats
.
max_attempts
}
\n
"
)
sys
.
std
out
.
write
(
f
"
Attempt
{
stats
.
current_attempt
}
out of maximum
{
stats
.
max_attempts
}
\n
"
)
def
start_fileset
(
self
,
stats
):
sys
.
std
err
.
write
(
f
"
Working on
{
stats
.
current_fileset_description
}
\n
"
)
sys
.
std
out
.
write
(
f
"
Working on
{
stats
.
current_fileset_description
}
\n
"
)
def
finished_file
(
self
,
stats
,
local_path
,
is_cache_hit
):
reason
=
"
downloaded
"
if
is_cache_hit
:
reason
=
"
found in local cache
"
sys
.
std
err
.
write
(
f
"
{
local_path
}
{
reason
}
. (Downloaded
{
len
(
stats
.
downloaded_files
)
}
files,
{
human_bytes
(
stats
.
downloaded_size
)
}
. Found in cache
{
len
(
stats
.
cached_files
)
}
files,
{
human_bytes
(
stats
.
cached_size
)
}
)
\n
"
)
sys
.
std
out
.
write
(
f
"
{
local_path
}
{
reason
}
. (Downloaded
{
len
(
stats
.
downloaded_files
)
}
files,
{
human_bytes
(
stats
.
downloaded_size
)
}
. Found in cache
{
len
(
stats
.
cached_files
)
}
files,
{
human_bytes
(
stats
.
cached_size
)
}
)
\n
"
)
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