-
Notifications
You must be signed in to change notification settings - Fork 96
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
Displaying Detailed Job Progress While Using Run Command #4254
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
cmd/util/live_table_writer.go
Outdated
const DefaultRefreshInterval = time.Millisecond | ||
const ESC = 27 |
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.
are we refreshing every millisecond by default? can we instead refresh whenever there is update?
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.
Done.
cmd/util/live_table_writer.go
Outdated
if w.ticker == nil { | ||
w.ticker = time.NewTicker(w.RefreshInterval) | ||
w.tdone = make(chan bool) | ||
} | ||
|
||
go w.Listen() |
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.
better to make sure we only start once
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.
Done ! Getting rid of listen, start, and stop overall.
cmd/util/live_table_writer.go
Outdated
if w.ticker != nil { | ||
_ = w.Flush() | ||
} |
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.
unnecessary check since you are existing the for loop when stopping the ticker. Also weird to read a ticker that returns a tick and can be nil. This can be a more readable pattern
func Start() {
once.do({
go listen()
)}
// done channel should be instantiated in the constructor
}
func listend() {
ticker := start ticker
defer stop ticker
for {...}
}
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.
Done ! Getting rid of listen, start, and stop overall.
cmd/util/live_table_writer.go
Outdated
w.tdone <- true | ||
<-w.tdone |
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.
you should just close the channel here instead of inside listen
. Listen should just exit the for loop if the channel returns
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.
Done ! Getting rid of listen, start, and stop overall.
jobID string | ||
occurred time.Time | ||
executionID string | ||
eventTopic models.EventTopic | ||
event models.Event |
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.
aren't topic and occured already part of the event?
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.
So occurred, inside job history has a logic, where if the event timestamp is not present it returns the history timestamp. Hence tracking it separately.
// print hint in green | ||
if j.event.Details[models.DetailsKeyHint] != "" { | ||
res += "\n" + fmt.Sprintf( | ||
"%s %s", output.BoldStr(output.GreenStr("* Hint:")), j.event.Details[models.DetailsKeyHint]) | ||
} | ||
} |
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.
similar to job describe
, lets print all details if debug mode is enabled
func (j *JobProgressPrinter) followLogs(jobID string, cmd *cobra.Command) error { | ||
cmd.Printf("Job successfully submitted. Job ID: %s\n", jobID) | ||
cmd.Printf("Waiting for logs... (Enter Ctrl+C to exit at any time, your job will continue running):\n\n") |
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.
can you share snippets in the PR comment of different invocations of job submissions? For example, id-only
, wait=false
, follow logs, queueing triggered, queueing triggered and fulfilled, and cases with failures
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.
Acknowledged. Doing that now.
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.
Thanks. Looking at --id-only
output, it should only be the id of the job so users can pipe it into other commands, such as bacalhau docker run ubuntu echo hello --id-only | xargs bacalhau job describe
It will wait until job completion, but only print the job id
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.
Makes sense ! Fixing it now :)
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.
Done with commit 57add2b
This PR aims at the following
closes #4233