-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
use compute log manager to store backfill daemon logs for UI display #21786
use compute log manager to store backfill daemon logs for UI display #21786
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @jamiedemaria and the rest of your teammates on Graphite |
) | ||
evaluation_time = pendulum.now("UTC") | ||
|
||
# TODO - probably need to scope by code location. for now just put everything together for testing |
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.
before merge - align on a log key scheme
|
||
# TODO - probably need to scope by code location. for now just put everything together for testing | ||
log_key = ["backfill", backfill_id, evaluation_time.strftime("%Y%m%d_%H%M%S")] | ||
with InstigationLogger( |
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.
From my understanding, the InstigationLogger
has only been used for things like sensor logs where the logs are user defined. Since we want to have our backfill daemon logs appear in the UI, that could change some of the assumptions made by the InstigationLogger
- the
InstigationLogger
always uses thedagster
logger, whereas in this case we want the backfill daemon loggersuper().__init__(name="dagster", level=coerce_valid_log_level(level))
|
||
# TODO - probably need to scope by code location. for now just put everything together for testing | ||
log_key = ["backfill", backfill_id, evaluation_time.strftime("%Y%m%d_%H%M%S")] | ||
with InstigationLogger( |
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.
- sensor logs are stored by the user, for OSS we can use the same storage, but for plus we will likely need to store the logs ourselves. my homework for today is to understand how we would handle this in plus, but any ideas/opinions on how to manage this from those with more platform experience would be super helpful
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.
The use of the compute log manager for sensor logs is kind of a hack / implementation detail.
Compute logs are user-configured, and for a lot of our customers are not viable because they want a hard separation between Dagster and their computation layer.
We're almost better off with a new instance API call like storeLogMessage or something like that. In Cloud, that thing can be backed by something like some S3 storage (that is different than the user-configured compute log manager) so that these messages never touch Postgres.
In OSS, we can use the compute log manager or another configured instance class to put these logs someplace durable.
|
||
# TODO - probably need to scope by code location. for now just put everything together for testing | ||
log_key = ["backfill", backfill_id, evaluation_time.strftime("%Y%m%d_%H%M%S")] | ||
with InstigationLogger( |
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.
- To get these logs available in the UI, I had to do add some special logic for how to get the message from the log record https://github.com/dagster-io/dagster/pull/21787/files#diff-a2c3875505d59d1c50f93bbb312c943044d849e91c319d5349b38f57947ff16eR58-R62 because the
_annotate_record
of the InstigationLogger doesn't seem to get applieddef _annotate_record(self, record: logging.LogRecord) -> logging.LogRecord:
more homework for myself today is to figure out why this is happening so that we can ideally not have that special behavior in the GQL layer
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.
hmm, yeah, our logger overrides is really clunky. It's been a while, but I think it's because we want to use the Logger interface for something that's really a LogHandler.
@alangenfeld @gibsondan @prha like #21750 i'm marking this ready for review to get it in review queues for the open questions. it's definitely needs a lot of work before it could actually be merged, and i appreciate you looking through my kind of hacky code. one thing i'm curious to get opinions on is if the issues i left in the comments are reasons we should diverge from the |
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.
Happy to do a quick sync on this.
|
||
# TODO - probably need to scope by code location. for now just put everything together for testing | ||
log_key = ["backfill", backfill_id, evaluation_time.strftime("%Y%m%d_%H%M%S")] | ||
with InstigationLogger( |
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.
The use of the compute log manager for sensor logs is kind of a hack / implementation detail.
Compute logs are user-configured, and for a lot of our customers are not viable because they want a hard separation between Dagster and their computation layer.
We're almost better off with a new instance API call like storeLogMessage or something like that. In Cloud, that thing can be backed by something like some S3 storage (that is different than the user-configured compute log manager) so that these messages never touch Postgres.
In OSS, we can use the compute log manager or another configured instance class to put these logs someplace durable.
|
||
# TODO - probably need to scope by code location. for now just put everything together for testing | ||
log_key = ["backfill", backfill_id, evaluation_time.strftime("%Y%m%d_%H%M%S")] | ||
with InstigationLogger( |
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.
hmm, yeah, our logger overrides is really clunky. It's been a while, but I think it's because we want to use the Logger interface for something that's really a LogHandler.
6c7061b
to
514eae3
Compare
7ff30c5
to
e75ef3d
Compare
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.
to your queue
stack is deprecated in favor of #22003. closing |
Summary & Motivation
proof of concept PR to look at how we can get backfill daemon logs surfaced to the UI. I left comments throughout the PR with some open design questions. If it is more convenient to do a meeting to chat through all of this, I'm happy to put that together
How I Tested These Changes