-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_prefect_server.expect
43 lines (35 loc) · 1.06 KB
/
start_prefect_server.expect
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/expect -f
# Start the Prefect server
spawn prefect server start --host 0.0.0.0
# Set timeout to 180 seconds
set timeout 180
# Wait for the specific prompt
expect {
"How would you like to proceed?" {
# Send the ANSI escape sequence for down arrow key
send "\033\[B\r"
# Wait for the API URL prompt
expect "Enter the `PREFECT_API_URL` value*"
# Send the API URL and Enter
send "http://127.0.0.1:4200/api\r"
# Send another enter key to ensure it goes through
send "\r"
}
timeout {
# Handle timeout case
puts "Error: Timed out while waiting for Prefect server prompt."
exit 1
}
eof {
# Handle unexpected termination
puts "Error: Unexpected end of the process."
exit 1
}
}
# Ensure the Prefect server starts correctly before exiting
expect {
"Prefect server is up and running" { exit 0 }
timeout { puts "Error: Prefect server did not start properly"; exit 1 }
}
# Keep the Prefect server running
interact