Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Lozac'h Loic
AgriFrozenAreaProject
Commits
e7e96af6
Commit
e7e96af6
authored
Aug 18, 2021
by
Lozac'h Loic
Browse files
debug
parent
f0c0bbfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
frozenapp/eodags1.py
View file @
e7e96af6
...
...
@@ -113,8 +113,8 @@ class EodagS1Downloader():
products_availability
[
pp
.
properties
[
"id"
]]
=
[
pp
]
print
(
f
"Scihub has got
{
nbsci_online
}
ONLINE products over
{
estimated_scihub_of_results
}
"
f
"PEPS has got
{
nbpeps_online
}
ONLINE products over
{
estimated_peps_of_results
}
"
f
"
\n
Scihub has got
{
nbsci_online
}
ONLINE products over
{
estimated_scihub_of_results
}
"
f
"
\n
PEPS has got
{
nbpeps_online
}
ONLINE products over
{
estimated_peps_of_results
}
"
)
nb_dblav
=
0
...
...
@@ -122,7 +122,7 @@ class EodagS1Downloader():
if
len
(
products_availability
[
p
])
==
1
:
print
(
f
"Product
{
p
}
is only available on
{
products_availability
[
p
][
0
].
provider
}
"
f
"
\n
Product
{
p
}
is only available on
{
products_availability
[
p
][
0
].
provider
}
"
)
else
:
nb_dblav
+=
1
...
...
@@ -137,8 +137,8 @@ class EodagS1Downloader():
allserialfile
=
os
.
path
.
join
(
downdir
,
nowstr
+
"_alldownloads.json"
)
remainserialfile
=
os
.
path
.
join
(
downdir
,
nowstr
+
"_remaindownloads.json"
)
while
still2download
:
for
p
in
sorted
(
products_availability
,
key
=
len
(
products_availability
.
get
),
reverse
=
True
):
print
(
f
"Starting Download
{
p
}
..."
)
for
p
in
sorted
(
products_availability
,
key
=
lambda
k
:
len
(
products_availability
[
k
]
),
reverse
=
True
):
print
(
f
"
\n
Starting Download
{
p
}
..."
)
with
closing
(
StringIO
())
as
tqdm_out
:
with
ProgressCallback
(
file
=
tqdm_out
)
as
bar
:
products_availability
[
p
][
0
].
download
(
bar
,
extract
=
False
,
outputs_prefix
=
downdir
)
...
...
@@ -154,24 +154,24 @@ class EodagS1Downloader():
if
len
(
products_downloaded
)
==
nbProducts2d
:
still2download
=
False
print
(
f
"All downloads successful."
f
"Serializing search products to
{
allserialfile
}
"
f
"Exiting."
f
"
\n
All downloads successful."
f
"
\n
Serializing search products to
{
allserialfile
}
"
f
"
\n
Exiting."
)
elif
nb_allretry
==
5
:
still2download
=
False
print
(
f
"Max number of retries has been completed."
f
"Serializing all search products to
{
allserialfile
}
"
f
"Serializing remain search products to
{
remainserialfile
}
"
f
"Exiting."
f
"
\n
Max number of retries has been completed."
f
"
\n
Serializing all search products to
{
allserialfile
}
"
f
"
\n
Serializing remain search products to
{
remainserialfile
}
"
f
"
\n
Exiting."
)
else
:
print
(
f
"Pass n#
{
nb_allretry
}
has reached
{
len
(
products_downloaded
)
}
over
{
nbProducts2d
}
expected"
)
print
(
f
"Waiting
{
passwait
[
nb_allretry
-
1
]
}
minutes before retrying..."
)
print
(
f
"
\n
Pass n#
{
nb_allretry
}
has reached
{
len
(
products_downloaded
)
}
over
{
nbProducts2d
}
expected"
)
print
(
f
"
\n
Waiting
{
passwait
[
nb_allretry
-
1
]
}
minutes before retrying..."
)
restartd
=
datetime
.
now
()
+
timedelta
(
minutes
=
passwait
[
nb_allretry
-
1
])
restartstr
=
restartd
.
strftime
(
"%Y/%m/%d-%H:%M:%S"
)
print
(
f
"Restart at
{
restartstr
}
"
)
print
(
f
"
\n
Restart at
{
restartstr
}
"
)
time
.
sleep
(
passwait
[
nb_allretry
-
1
]
*
60
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment