mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-18 14:06:59 +00:00
Fix Docker and revert openmetadata-start.sh changes (#4518)
* Fix Docker and revert openmetadata-start.sh changes * Fix Docker - added error handling * Fix Docker - added error handling * Added time.sleep * Resolve Code smell
This commit is contained in:
parent
55c91b2a27
commit
9cb9792b7e
@ -14,11 +14,6 @@ MYSQL="${MYSQL_HOST:-mysql}":"${MYSQL_PORT:-3306}"
|
||||
while ! wget -O /dev/null -o /dev/null "${MYSQL}";
|
||||
do echo "Trying to connect to ${MYSQL}"; sleep 5;
|
||||
done
|
||||
ELASTICSEARCH="${ELASTICSEARCH_HOST:-elasticsearch}":"${ELASTICSEARCH_PORT:-9200}"
|
||||
while ! wget -O /dev/null -o /dev/null "${ELASTICSEARCH}";
|
||||
do echo "Trying to connect to ${ELASTICSEARCH}"; sleep 5;
|
||||
done
|
||||
sleep 5
|
||||
cd /openmetadata-*/
|
||||
./bootstrap/bootstrap_storage.sh migrate-all
|
||||
./bin/openmetadata-server-start.sh conf/openmetadata.yaml
|
||||
|
@ -6,11 +6,10 @@ import tempfile
|
||||
import time
|
||||
import traceback
|
||||
from base64 import b64encode
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import timedelta
|
||||
|
||||
import click
|
||||
import requests as requests
|
||||
from requests._internal_utils import to_native_string
|
||||
|
||||
from metadata.generated.schema.entity.data.table import Table
|
||||
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import (
|
||||
@ -165,7 +164,6 @@ def run_docker(
|
||||
docker.compose.stop()
|
||||
logger.info("Docker compose for OpenMetadata stopped successfully.")
|
||||
if reset_db:
|
||||
|
||||
reset_db_om(docker)
|
||||
if clean:
|
||||
logger.info(
|
||||
@ -230,6 +228,7 @@ def ingest_sample_data() -> None:
|
||||
"""
|
||||
Trigger sample data DAGs
|
||||
"""
|
||||
from requests._internal_utils import to_native_string
|
||||
|
||||
base_url = "http://localhost:8080/api"
|
||||
dags = ["sample_data", "sample_usage", "index_metadata"]
|
||||
@ -243,9 +242,20 @@ def ingest_sample_data() -> None:
|
||||
),
|
||||
)
|
||||
client = REST(client_config)
|
||||
|
||||
timeout = time.time() + 60 * 5 # Timeout of 5 minutes
|
||||
while True:
|
||||
try:
|
||||
resp = client.get("/dags")
|
||||
if resp:
|
||||
break
|
||||
elif time.time() > timeout:
|
||||
raise TimeoutError("Ingestion container timed out")
|
||||
except TimeoutError as err:
|
||||
print(err)
|
||||
sys.exit(1)
|
||||
except Exception:
|
||||
sys.stdout.write(".")
|
||||
time.sleep(5)
|
||||
for dag in dags:
|
||||
json_sample_data = {
|
||||
"dag_run_id": "{}_{}".format(dag, datetime.now()),
|
||||
}
|
||||
client.post("/dags/{}/dagRuns".format(dag), data=json.dumps(json_sample_data))
|
||||
json_sample_data = {"is_paused": False}
|
||||
client.patch("/dags/{}".format(dag), data=json.dumps(json_sample_data))
|
||||
|
Loading…
x
Reference in New Issue
Block a user