-
Notifications
You must be signed in to change notification settings - Fork 41
Conductor #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… pool, fix a small race in a test, remove unused code
| // If no queue name was specified, only include workflows that have a queue name | ||
| var filteredWorkflows []WorkflowStatus | ||
| if req.Body.QueueName == nil { | ||
| for _, wf := range workflows { | ||
| if wf.QueueName != "" { | ||
| filteredWorkflows = append(filteredWorkflows, wf) | ||
| } | ||
| } | ||
| } else { | ||
| filteredWorkflows = workflows | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I'll eventually add a filter that'll go down the SQL query (while maintaining the simplified listing UX)
dbos/dbos.go
Outdated
|
|
||
| // Initialize conductor if API key is provided | ||
| if config.ConductorAPIKey != "" { | ||
| if initExecutor.executorID == "local" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's safer to just always generate a new ID here. Otherwise, there's potential for trouble--multiple servers sharing the same ID, for example.
| AppName: inputConfig.AppName, | ||
| Logger: inputConfig.Logger, | ||
| AdminServer: inputConfig.AdminServer, | ||
| DatabaseURL: inputConfig.DatabaseURL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Application version should also be an option here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm adding this and executor ID in a different PR
Implement Conductor client.
Design
A conductor object is attached to a
DBOSContext. Its lifecycle management is done like other resources, insideDBOSContextLaunchandShutdownmethods.The conductor operates through two goroutines a "main" goroutine handling conductor messages, and a "ping" goroutine to keep the connection alive.
Main goroutine
The main goroutine is entirely responsible for managing the connection: whenever it detects it should connect to the server, it'll start a ping goroutine. Whenever it gets an error (e.g., reading on the websocket or sending a message), it will set the connection for closing.
Ping goroutine
The ping goutine will exit and signal the connection should be close if:
Others
ListWorkflows