Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
Import Process
Import API
Commits
64c6a845
Commit
64c6a845
authored
Apr 19, 2021
by
Matthias
Browse files
use topicnames from configmap
parent
95a789d9
Pipeline
#25037
passed with stages
in 2 minutes and 1 second
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
import_api_app/__init__.py
View file @
64c6a845
...
...
@@ -39,6 +39,8 @@ def create_app(test_config=None):
app
.
config
[
'drupal-password'
]
=
os
.
environ
[
'DRUPAL_PASSWORD'
]
app
.
config
[
'drupal-api-url'
]
=
os
.
environ
[
'DRUPAL_API_URL'
]
app
.
config
[
'drupal-api-key'
]
=
os
.
environ
[
'DRUPAL_API_KEY'
]
app
.
config
[
'topic-configs'
]
=
os
.
environ
[
'TOPIC_CONFIGS'
]
app
.
config
[
'topic-drupal-export'
]
=
os
.
environ
[
'TOPIC_DRUPAL_EXPORT'
]
app
.
config
[
'sftp_host'
]
=
os
.
environ
[
'SFTP_HOST'
]
app
.
config
[
'sftp_port'
]
=
os
.
environ
[
'SFTP_PORT'
]
app
.
config
[
'sftp_user'
]
=
os
.
environ
[
'SFTP_USER'
]
...
...
import_api_app/helm-charts/helm-values/values-prod.yaml
View file @
64c6a845
...
...
@@ -14,3 +14,5 @@ importApiConfig: import-api-prod-config
importApiUrl
:
'
https://{{
.Values.k8sEnvironment}}-import.memobase.k8s.unibas.ch'
drupalApiUrl
:
'
https://memobase-customer-live.outermedia.net'
topicConfigs
:
'
mb-di-config-prod'
topicDrupalExport
:
'
mb-gi-drupal-export-prod'
import_api_app/helm-charts/helm-values/values-stage.yaml
View file @
64c6a845
...
...
@@ -14,3 +14,5 @@ importApiConfig: import-api-test-config
importApiUrl
:
'
https://{{
.Values.k8sEnvironment}}-import.memobase.k8s.unibas.ch'
drupalApiUrl
:
'
https://mb-wf1.memobase.unibas.ch'
topicConfigs
:
'
mb-di-config-stage'
topicDrupalExport
:
'
mb-gi-drupal-export-stage'
import_api_app/helm-charts/helm-values/values-test.yaml
View file @
64c6a845
...
...
@@ -14,3 +14,5 @@ importApiConfig: import-api-test-config
importApiUrl
:
'
https://{{
.Values.k8sEnvironment}}-import.memobase.k8s.unibas.ch'
drupalApiUrl
:
'
https://mb-wf1.memobase.unibas.ch'
topicConfigs
:
'
mb-di-config-test'
topicDrupalExport
:
'
mb-gi-drupal-export-test'
import_api_app/resources/FetchMappingFile.py
View file @
64c6a845
...
...
@@ -84,7 +84,7 @@ class FetchMappingFile(Resource):
raise
ImportApiError
(
message
)
# 2. write file content into kafka topic
topic
=
'mb-di
-config
-prod'
topic
=
current_app
.
config
[
'topic
-config
s'
]
try
:
producer
=
KafkaProducer
(
bootstrap_servers
=
current_app
.
config
[
'kafka-broker-url'
],
key_serializer
=
str
.
encode
)
...
...
import_api_app/resources/MonitorDrupalJsonApiInstitution.py
View file @
64c6a845
...
...
@@ -146,7 +146,7 @@ class MonitorDrupalJsonApiInstitution(Resource):
value_serializer
=
lambda
m
:
json
.
dumps
(
m
,
ensure_ascii
=
False
)
.
encode
(
'utf-8'
))
key
=
bytes
(
topic_value
.
get
(
'field_memobase_id'
),
encoding
=
'utf-8'
)
producer
.
send
(
'mb-gi
-drupal-export
-prod
'
,
topic_value
,
key
)
producer
.
send
(
current_app
.
config
[
'topic
-drupal-export'
]
,
topic_value
,
key
)
except
Exception
as
ex
:
msg
=
'Exception for '
+
institutionId
+
': '
+
str
(
ex
)
+
'
\n
'
+
\
traceback
.
format_exc
()
...
...
import_api_app/resources/MonitorDrupalJsonApiRecordSet.py
View file @
64c6a845
...
...
@@ -211,7 +211,7 @@ class MonitorDrupalJsonApiRecordSet(Resource):
value_serializer
=
lambda
m
:
json
.
dumps
(
m
,
ensure_ascii
=
False
)
.
encode
(
'utf-8'
))
key
=
bytes
(
topicValue
.
get
(
'field_memobase_id'
),
encoding
=
'utf-8'
)
producer
.
send
(
'mb-gi
-drupal-export
-prod
'
,
topicValue
,
key
=
key
)
producer
.
send
(
current_app
.
config
[
'topic
-drupal-export'
]
,
topicValue
,
key
=
key
)
except
Exception
as
ex
:
msg
=
'Exception for '
+
recordSetId
+
': '
+
str
(
ex
)
+
'
\n
'
+
\
traceback
.
format_exc
()
...
...
Write
Preview
Supports
Markdown
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