Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions Model/bin/presenter_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,35 @@ wdkServer SiteSearchData $SERVER_PORT -cleanCacheAtStartup &

echo "waiting for server to be available"

SERVER_AVAILABLE=false
start=$(date +%s)
while [ $(($(date +%s) - $start)) -lt 180 ]
# while true
do
echo "checking port $SERVER_PORT..."
if nc -zv localhost:$SERVER_PORT
if nc -zv localhost:$SERVER_PORT
then
echo 'server available'
SERVER_AVAILABLE=true
break
fi
sleep 1
done

if [ "$SERVER_AVAILABLE" = false ]; then
echo "ERROR: Server on port $SERVER_PORT failed to become available after 180 seconds" >&2
kill %1 2>/dev/null
exit 1
fi

echo "$(date -u) server available"

# make output dir and run commands to produce output

mkdir $DESTINATION_DIRECTORY &&\
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this one. By chaining commands with &&, it ensures that it doesn't run the subsequent command if the previous one fails.
On the other hand, how likely is it for the mkdir or echo to fail? Unless the idea was to skip running ssCreateWdkMetaBatch if ssCreateWdkRecordsBatch fails.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's what we are after, we should consider extending the chain to include call to ssLoadMultipleBatches as well.

echo "$(date -u) starting ssCreateWdkRecordsBatch" &&\
ssCreateWdkRecordsBatch dataset-presenter $PROJECT_ID http://localhost:$SERVER_PORT $DESTINATION_DIRECTORY --paramName projectId --paramValue $PROJECT_ID &&\
echo "$(date -u) starting ssCreateWdkMetaBatch" &&\
mkdir $DESTINATION_DIRECTORY
echo "$(date -u) starting ssCreateWdkRecordsBatch"
ssCreateWdkRecordsBatch dataset-presenter $PROJECT_ID http://localhost:$SERVER_PORT $DESTINATION_DIRECTORY --paramName projectId --paramValue $PROJECT_ID
echo "$(date -u) starting ssCreateWdkMetaBatch"
ssCreateWdkMetaBatch $SITE_BASE_URL/service/ $PROJECT_ID $DESTINATION_DIRECTORY

echo "produced files:"
Expand Down