File tree Expand file tree Collapse file tree 7 files changed +45
-28
lines changed
Expand file tree Collapse file tree 7 files changed +45
-28
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env python3
2+ import socket
3+ import sys
4+
5+ if len (sys .argv ) != 2 :
6+ print ("Usage: allocate_ports.py <number_of_ports>" , file = sys .stderr )
7+ sys .exit (1 )
8+
9+ num_ports = int (sys .argv [1 ])
10+
11+ ports = []
12+ sockets = []
13+ for _ in range (num_ports ):
14+ s = socket .socket (socket .AF_INET , socket .SOCK_STREAM )
15+ s .bind (("127.0.0.1" , 0 ))
16+ port = s .getsockname ()[1 ]
17+ ports .append (str (port ))
18+ sockets .append (s )
19+ for s in sockets :
20+ s .close ()
21+ sys .stdout .write ("\n " .join (ports ))
22+ sys .stdout .flush ()
Original file line number Diff line number Diff line change 1- Local = true
1+ Local = false
22Cloud = false
33
44[EnvMatrix ]
5- DATABRICKS_CLI_DEPLOYMENT = [" terraform" ]
5+ DATABRICKS_CLI_DEPLOYMENT = [" terraform" , " direct-exp " ]
Original file line number Diff line number Diff line change 44# so we don't need to start it in background. It will install the dependencies as part of the command
55trace $CLI apps run-local --prepare-environment --entry-point test.yml 2>&1 | grep -w "Hello, world"
66
7- PORT=8080
8- DEBUG_PORT=5252
9- PROXY_PORT=8081
7+ # Get 3 unique ports sequentially to avoid conflicts
8+ PORTS=$(allocate_ports.py 3 | tr -d '\r')
9+
10+ # Read ports into array
11+ PORTS_ARR=($(echo "$PORTS"))
12+ PORT="${PORTS_ARR[0]}"
13+ DEBUG_PORT="${PORTS_ARR[1]}"
14+ PROXY_PORT="${PORTS_ARR[2]}"
1015
1116title "Starting the app in background..."
1217trace $CLI apps run-local --prepare-environment --debug --port "$PROXY_PORT" --debug-port "$DEBUG_PORT" --app-port "$PORT" > ../out.run.txt 2>&1 &
@@ -23,11 +28,6 @@ while [ -z "$(grep -o "Server is running on port " out.run.txt 2>/dev/null)" ];
2328 sleep 1
2429done
2530
26- # Make sure the proxy is ready to serve requests
27- while [ -z "$(grep -o "To access your app go to " out.run.txt 2>/dev/null)" ]; do
28- sleep 1
29- done
30-
3131title "Checking app is running..."
3232trace curl -s -o - http://127.0.0.1:$PROXY_PORT | grep -w "Hello From App"
3333
Original file line number Diff line number Diff line change 1+ # Temporarily disabled due to the flakiness like here https://github.com/databricks/cli/actions/runs/17234131593/job/48894892423
12Cloud = false
2- Local = true
3+ Local = false
34RecordRequests = false
45Timeout = ' 2m'
56TimeoutWindows = ' 10m'
@@ -20,6 +21,3 @@ New='127.0.0.1:$(port)'
2021[[Repls ]]
2122Old =' To debug your app, attach a debugger to port [0-9]+'
2223New =' To debug your app, attach a debugger to port $(debug_port)'
23-
24- [EnvMatrix ]
25- DATABRICKS_CLI_DEPLOYMENT = [" terraform" ]
Original file line number Diff line number Diff line change 1- Local = true
1+ Local = false
22Cloud = false
33
44[EnvMatrix ]
5- DATABRICKS_CLI_DEPLOYMENT = [" terraform" ]
5+ DATABRICKS_CLI_DEPLOYMENT = [" terraform" , " direct-exp " ]
Original file line number Diff line number Diff line change @@ -6,9 +6,14 @@ trace errcode $CLI apps run-local --entry-point value-from.yml 2>&1
66# so we don't need to start it in background. It will install the dependencies as part of the command
77trace $CLI apps run-local --prepare-environment --entry-point test.yml 2>&1 | grep -w "Hello, world"
88
9- PORT=8080
10- DEBUG_PORT=5252
11- PROXY_PORT=8081
9+ # Get 3 unique ports sequentially to avoid conflicts
10+ PORTS=$(allocate_ports.py 3 | tr -d '\r')
11+
12+ # Read ports into array
13+ PORTS_ARR=($(echo "$PORTS"))
14+ PORT="${PORTS_ARR[0]}"
15+ DEBUG_PORT="${PORTS_ARR[1]}"
16+ PROXY_PORT="${PORTS_ARR[2]}"
1217
1318title "Starting the app in background..."
1419trace $CLI apps run-local --prepare-environment --debug --port "$PROXY_PORT" --debug-port "$DEBUG_PORT" --app-port "$PORT" > ../out.run.txt 2>&1 &
@@ -25,11 +30,6 @@ while [ -z "$(grep -o "Python Flask app has started with" out.run.txt 2>/dev/nul
2530 sleep 1
2631done
2732
28- # Make sure the proxy is ready to serve requests
29- while [ -z "$(grep -o "To access your app go to " out.run.txt 2>/dev/null)" ]; do
30- sleep 1
31- done
32-
3333title "Checking app is running..."
3434trace curl -s -o - http://127.0.0.1:$PROXY_PORT | jq
3535
Original file line number Diff line number Diff line change 11Cloud = false
2- Local = true
2+ Local = false
33RecordRequests = false
44Timeout = ' 2m'
55TimeoutWindows = ' 10m'
@@ -20,6 +20,3 @@ New='127.0.0.1:$(port)'
2020[[Repls ]]
2121Old =' To debug your app, attach a debugger to port [0-9]+'
2222New =' To debug your app, attach a debugger to port $(debug_port)'
23-
24- [EnvMatrix ]
25- DATABRICKS_CLI_DEPLOYMENT = [" terraform" ]
You can’t perform that action at this time.
0 commit comments