Skip to content
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

Closed

Conversation

jamiedemaria
Copy link
Contributor

@jamiedemaria jamiedemaria commented May 10, 2024

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

Copy link
Contributor Author

jamiedemaria commented May 10, 2024

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.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @jamiedemaria and the rest of your teammates on Graphite Graphite

@jamiedemaria jamiedemaria changed the title wip - backfill logging through to ui prototype - use compute log manager to store backfill daemon logs for UI display May 13, 2024
)
evaluation_time = pendulum.now("UTC")

# TODO - probably need to scope by code location. for now just put everything together for testing
Copy link
Contributor Author

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(
Copy link
Contributor Author

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

  1. the InstigationLogger always uses the dagster logger, whereas in this case we want the backfill daemon logger
    super().__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(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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

Copy link
Member

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(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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 applied
    def _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

Copy link
Member

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.

@jamiedemaria
Copy link
Contributor Author

@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 InstigationLogger and do something more specific to this daemon logging system. i'm kind of learning about logging as i go with this so i'm not up to speed on our logging history so i'm not sure what this history and intentions of theInstigationLogger are.

@jamiedemaria jamiedemaria marked this pull request as ready for review May 14, 2024 15:28
@jamiedemaria jamiedemaria changed the title prototype - use compute log manager to store backfill daemon logs for UI display use compute log manager to store backfill daemon logs for UI display May 14, 2024
Copy link
Member

@prha prha left a 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(
Copy link
Member

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(
Copy link
Member

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.

Copy link
Member

@alangenfeld alangenfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to your queue

@jamiedemaria jamiedemaria marked this pull request as draft May 28, 2024 13:56
@jamiedemaria
Copy link
Contributor Author

stack is deprecated in favor of #22003. closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants