EOX GitLab Instance
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Data Handling
core
Commits
fba45fa0
Commit
fba45fa0
authored
3 years ago
by
Nikola Jankovic
Browse files
Options
Downloads
Patches
Plain Diff
added updates from v2
parent
428c5c94
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#18231
passed
3 years ago
Stage: test
Stage: deploy
Stage: chart
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile
+2
-1
2 additions, 1 deletion
Dockerfile
configure.sh
+1
-0
1 addition, 0 deletions
configure.sh
registrar/backend/eoxserver.py
+41
-12
41 additions, 12 deletions
registrar/backend/eoxserver.py
rgbnir_definition.json
+959
-1052
959 additions, 1052 deletions
rgbnir_definition.json
with
1003 additions
and
1065 deletions
Dockerfile
+
2
−
1
View file @
fba45fa0
...
...
@@ -53,7 +53,7 @@ ENV INSTANCE_ID="prism-view-server_core" \
INSTANCE_DIR="/var/www/pvs/dev/pvs_instance/" \
COLLECTION= \
UPLOAD_CONTAINER= \
DB=
"
postgis
"
\
DB=postgis \
DB_USER= \
DB_PW= \
DB_HOST= \
...
...
@@ -80,6 +80,7 @@ ENV INSTANCE_ID="prism-view-server_core" \
COLLECT_STATIC="false" \
REGISTRAR_REPLACE= \
GDAL_PAM_ENABLED="NO" \
EOXS_LAYER_SUFFIX_SEPARATOR="__" \
DEV="false"
COPY
. .
...
...
This diff is collapsed.
Click to expand it.
configure.sh
+
1
−
0
View file @
fba45fa0
...
...
@@ -34,6 +34,7 @@
echo
"EOXS_VALIDATE_IDS_NCNAME = False"
>>
pvs_instance/settings.py
echo
"EOXS_OPENSEARCH_RECORD_MODEL = 'eoxserver.resources.coverages.models.Product'"
>>
pvs_instance/settings.py
echo
"EOXS_LAYER_SUFFIX_SEPARATOR = '
${
EOXS_LAYER_SUFFIX_SEPARATOR
}
'"
>>
pvs_instance/settings.py
echo
"CACHES = {
'default': {
...
...
This diff is collapsed.
Click to expand it.
registrar/backend/eoxserver.py
+
41
−
12
View file @
fba45fa0
...
...
@@ -10,6 +10,7 @@ import sys
import
logging
from
typing
import
List
,
TYPE_CHECKING
,
TypedDict
import
json
from
urllib.parse
import
urlparse
import
django
from
django.db
import
transaction
...
...
@@ -106,6 +107,7 @@ class EOxServerBackend(Backend):
created_storage_auth
=
False
created_storage
=
False
storage_name
=
None
if
isinstance
(
source
,
LocalSource
):
storage
,
created_storage
=
backends
.
Storage
.
get_or_create
(
name
=
source
.
name
,
...
...
@@ -128,6 +130,13 @@ class EOxServerBackend(Backend):
endpoint_url
=
endpoint_url
[
len
(
'
http://
'
):]
bucket
=
source
.
bucket_name
# get default bucket name from "first" asset. The first path
# component is the bucket.
if
bucket
is
None
:
asset
=
next
(
iter
(
item
.
get_assets
().
values
()),
None
)
bucket
=
urlparse
(
asset
.
href
).
path
.
partition
(
'
/
'
)[
0
]
storage_auth
,
created_storage_auth
=
\
backends
.
StorageAuth
.
objects
.
get_or_create
(
name
=
(
...
...
@@ -196,31 +205,51 @@ class EOxServerBackend(Backend):
def
_register_with_stac
(
self
,
source
:
Source
,
item
:
'
Item
'
,
replace
:
bool
,
storage
,
product_type
:
ItemToProductTypeMapping
):
product_type
:
ItemToProductTypeMapping
,
create_product_type_model
:
bool
=
False
):
from
eoxserver.backends
import
models
as
backends
from
eoxserver.resources.coverages
import
models
from
eoxserver.resources.coverages.registration.stac
import
(
register_stac_product
,
create_product_type_from_stac_item
)
product_type_obj
,
_
=
create_product_type_from_stac_item
(
item
.
to_dict
(),
product_type_name
=
product_type
[
'
product_type
'
],
ignore_existing
=
True
,
coverage_mapping
=
product_type
.
get
(
'
coverages
'
,
{})
)
logger
.
info
(
f
"
Created Product Type
{
product_type_obj
}
"
)
# TODO: flag to re-use product type?
if
create_product_type_model
:
product_type_obj
,
created
=
create_product_type_from_stac_item
(
item
.
to_dict
(),
# TODO: use hash instead
product_type_name
=
product_type
[
'
name
'
],
ignore_existing
=
True
,
coverage_mapping
=
product_type
.
get
(
'
coverages
'
,
{})
)
else
:
created
=
False
product_type_obj
=
models
.
ProductType
.
objects
.
get
(
name
=
product_type
[
'
name
'
]
)
if
created
:
logger
.
info
(
f
"
Created Product Type
{
product_type_obj
}
"
)
else
:
logger
.
info
(
f
"
Using existing Product Type
{
product_type_obj
}
"
)
# resolve storage object
if
storage
:
storage
=
backends
.
Storage
.
objects
.
get
(
name
=
storage
[
0
])
product
,
_
=
register_stac_product
(
product
,
replaced
=
register_stac_product
(
item
.
to_dict
(),
product_type_obj
,
storage
,
replace
=
replace
,
coverage_mapping
=
product_type
.
get
(
'
coverages
'
,
{})
coverage_mapping
=
product_type
.
get
(
'
coverages
'
,
{}),
browse_mapping
=
product_type
.
get
(
'
browses
'
,
{}),
metadata_asset_names
=
product_type
.
get
(
'
metadata_assets
'
),
)
logger
.
info
(
f
"
Successfully
{
'
replaced
'
if
replaced
else
'
registered
'
}
"
f
"
Product
{
product
.
identifier
}
"
)
return
product
@transaction.atomic
...
...
@@ -264,7 +293,7 @@ class EOxServerBackend(Backend):
raise
RegistrationError
(
f
'
{
item
}
not matched to any product_type
'
)
logger
.
info
(
f
'
Registering into EOxServer for type
'
f
'"
{
product_type
[
"
product_typ
e
"
]
}
"'
f
'"
{
product_type
[
"
nam
e
"
]
}
"'
)
product
=
self
.
_register_with_stac
(
...
...
This diff is collapsed.
Click to expand it.
rgbnir_definition.json
+
959
−
1052
View file @
fba45fa0
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