Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Theia stack
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esa-common
che7
stacks
Theia stack
Commits
124310a0
Commit
124310a0
authored
5 years ago
by
edupin
Browse files
Options
Downloads
Patches
Plain Diff
correction of stack
parent
e245a5fb
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
RestClient.py
+15
-6
15 additions, 6 deletions
RestClient.py
buildEclipseStack.sh
+3
-3
3 additions, 3 deletions
buildEclipseStack.sh
python_stack_image/scripts/RestClient.py
+15
-6
15 additions, 6 deletions
python_stack_image/scripts/RestClient.py
with
33 additions
and
15 deletions
RestClient.py
+
15
−
6
View file @
124310a0
...
...
@@ -12,7 +12,6 @@ from properties.p import Property
from
typing
import
Iterable
logging
.
basicConfig
(
filename
=
'
RestClient.log
'
,
level
=
logging
.
DEBUG
,
format
=
'
%(asctime)s %(levelname)-8s %(message)s
'
,
datefmt
=
'
%Y-%m-%d %H:%M:%S
'
)
url
=
os
.
environ
[
'
BMAP_BACKEND_URL
'
]
+
'
catalogue/granule/
'
...
...
@@ -174,15 +173,24 @@ def download_granule(granule_id: str, target_Dir: str) -> Iterable:
try
:
response
=
requests
.
get
(
url
+
'
granulename/
'
+
granule_id
)
json_str
=
response
.
text
print
(
target_Dir
)
# if the response body contains something
if
len
(
json_str
)
>
0
:
json_obj
=
json
.
loads
(
response
.
text
)
for
data
in
json_obj
[
'
Granule
'
][
'
dataList
'
][:]
:
urlToData
=
data
[
'
Data
'
][
'
urlToData
'
]
completeName
=
os
.
path
.
join
(
target_Dir
,
data
[
'
Data
'
][
'
fileName
'
])
r
=
requests
.
get
(
urlToData
,
allow_redirects
=
True
)
open
(
completeName
,
'
wb
'
).
write
(
r
.
content
)
#print(target_Dir+'/'+data['Data']['fileName'])
my_file
=
Path
(
target_Dir
+
'
/
'
+
data
[
'
Data
'
][
'
fileName
'
])
urlToData
=
''
if
my_file
.
is_file
():
print
(
data
[
'
Data
'
][
'
fileName
'
]
+
'
already exists in targetDir:
'
+
target_Dir
)
logging
.
info
(
data
[
'
Data
'
][
'
fileName
'
]
+
'
already exists in targetDir:
'
+
target_Dir
)
else
:
urlToData
=
data
[
'
Data
'
][
'
urlToData
'
]
completeName
=
os
.
path
.
join
(
target_Dir
,
data
[
'
Data
'
][
'
fileName
'
])
r
=
requests
.
get
(
urlToData
,
allow_redirects
=
True
)
open
(
completeName
,
'
wb
'
).
write
(
r
.
content
)
print
(
data
[
'
Data
'
][
'
fileName
'
]
+
'
has been successfully downloaded in targetDir:
'
+
target_Dir
)
logging
.
info
(
data
[
'
Data
'
][
'
fileName
'
]
+
'
has been successfully downloaded in targetDir:
'
+
target_Dir
)
return
urlToData
else
:
print
(
'
INFO: There is no data with ID:
'
+
granule_id
)
...
...
@@ -195,6 +203,7 @@ def download_granule(granule_id: str, target_Dir: str) -> Iterable:
#########################################################################
# -*- coding: utf-8 -*-
...
...
This diff is collapsed.
Click to expand it.
buildEclipseStack.sh
+
3
−
3
View file @
124310a0
docker build
-t
kosted/bmap-stack
.
docker run
--rm
kosted/bmap-stack pip freeze
docker push kosted/bmap-stack
docker build
-t
kosted/bmap-stack
:latest
.
docker run
--rm
kosted/bmap-stack
:latest
pip freeze
docker push kosted/bmap-stack
:latest
This diff is collapsed.
Click to expand it.
python_stack_image/scripts/RestClient.py
+
15
−
6
View file @
124310a0
...
...
@@ -12,7 +12,6 @@ from properties.p import Property
from
typing
import
Iterable
logging
.
basicConfig
(
filename
=
'
RestClient.log
'
,
level
=
logging
.
DEBUG
,
format
=
'
%(asctime)s %(levelname)-8s %(message)s
'
,
datefmt
=
'
%Y-%m-%d %H:%M:%S
'
)
url
=
os
.
environ
[
'
BMAP_BACKEND_URL
'
]
+
'
catalogue/granule/
'
...
...
@@ -174,15 +173,24 @@ def download_granule(granule_id: str, target_Dir: str) -> Iterable:
try
:
response
=
requests
.
get
(
url
+
'
granulename/
'
+
granule_id
)
json_str
=
response
.
text
print
(
target_Dir
)
# if the response body contains something
if
len
(
json_str
)
>
0
:
json_obj
=
json
.
loads
(
response
.
text
)
for
data
in
json_obj
[
'
Granule
'
][
'
dataList
'
][:]
:
urlToData
=
data
[
'
Data
'
][
'
urlToData
'
]
completeName
=
os
.
path
.
join
(
target_Dir
,
data
[
'
Data
'
][
'
fileName
'
])
r
=
requests
.
get
(
urlToData
,
allow_redirects
=
True
)
open
(
completeName
,
'
wb
'
).
write
(
r
.
content
)
#print(target_Dir+'/'+data['Data']['fileName'])
my_file
=
Path
(
target_Dir
+
'
/
'
+
data
[
'
Data
'
][
'
fileName
'
])
urlToData
=
''
if
my_file
.
is_file
():
print
(
data
[
'
Data
'
][
'
fileName
'
]
+
'
already exists in targetDir:
'
+
target_Dir
)
logging
.
info
(
data
[
'
Data
'
][
'
fileName
'
]
+
'
already exists in targetDir:
'
+
target_Dir
)
else
:
urlToData
=
data
[
'
Data
'
][
'
urlToData
'
]
completeName
=
os
.
path
.
join
(
target_Dir
,
data
[
'
Data
'
][
'
fileName
'
])
r
=
requests
.
get
(
urlToData
,
allow_redirects
=
True
)
open
(
completeName
,
'
wb
'
).
write
(
r
.
content
)
print
(
data
[
'
Data
'
][
'
fileName
'
]
+
'
has been successfully downloaded in targetDir:
'
+
target_Dir
)
logging
.
info
(
data
[
'
Data
'
][
'
fileName
'
]
+
'
has been successfully downloaded in targetDir:
'
+
target_Dir
)
return
urlToData
else
:
print
(
'
INFO: There is no data with ID:
'
+
granule_id
)
...
...
@@ -195,6 +203,7 @@ def download_granule(granule_id: str, target_Dir: str) -> Iterable:
#########################################################################
# -*- coding: utf-8 -*-
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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