pabloem commented on code in PR #22096:
URL: https://github.com/apache/beam/pull/22096#discussion_r915305749


##########
playground/backend/start_datastore_emulator.sh:
##########
@@ -0,0 +1,42 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Launch db emulator
+DATASTORE_FULL_ADDRESS="${DATASTORE_EMULATOR_HOST:-"127.0.0.1:8888"}"
+DATASTORE_PORT="${DATASTORE_FULL_ADDRESS##*:}"
+TEST_PROJECT_ID="test"
+
+waitport() {
+  while ! nc -z localhost "$1"; do
+    echo "waiting for datastore emulator to start..."
+    sleep 1
+  done
+}
+
+PID=$(lsof -t -i :"${DATASTORE_PORT}" -s tcp:LISTEN)
+
+if [ -z "$PID" ]; then
+  echo "Starting Datastore emulator"
+  nohup gcloud beta emulators datastore start \
+    --host-port="${DATASTORE_FULL_ADDRESS}" \
+    --project="${TEST_PROJECT_ID}" \
+    --consistency=1 \
+    --no-store-on-disk \
+    >/tmp/mock-db-logs &
+  waitport "$DATASTORE_PORT"
+else
+  echo "There is an instance of Datastore emulator already running"

Review Comment:
   are these fields meant to be used when deploying locally without docker 
compose?



##########
playground/backend/stop_datastore_emulator.sh:
##########
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Kill db emulator
+DATASTORE_FULL_ADDRESS="${DATASTORE_EMULATOR_HOST:-"127.0.0.1:8888"}"
+DATASTORE_PORT="${DATASTORE_FULL_ADDRESS##*:}"
+
+PID=$(lsof -t -i :"${DATASTORE_PORT}" -s tcp:LISTEN)
+if [ ! -z "$PID" ]; then
+  echo "Stopping Datastore emulator"
+  kill "$PID"

Review Comment:
   are these fields meant to be used when deploying locally without docker 
compose?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to