-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Making task log storage optional for Kubernetes Runner#18341
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
6fa6d1a
WIP: K8s config
uds5501 11c3f8e
Using fileTaskLogConfigs for storing task logs
uds5501 01dee63
Revert "Using fileTaskLogConfigs for storing task logs"
uds5501 45f1fda
Revert "WIP: K8s config"
uds5501 d34e193
WIP: Use delegation based task streamer
uds5501 12fa583
WIP: provide module bindings in k8s overlord module for delegate cons…
uds5501 99082a8
WIP: Enable multi level stream switching
uds5501 f6e225f
Complete switching log implementation
uds5501 61bf9dc
WIP: remove the embedded k8s test for now
uds5501 d8d22ae
Add StreamingTaskLogs to CLII
uds5501 493cf96
Add configuration error message for noop use case.
uds5501 04f9784
stream task status correctly
uds5501 aba0d14
Bind all extensions and refactor task log pushes
uds5501 a6a375c
make static checks happy
uds5501 297a713
add more tests
uds5501 ec7d715
Complete tests for indexing service task logs modules
uds5501 c1b788c
Complete addition of missing tests
uds5501 1784cec
Address review comments
uds5501 c30d8d3
make maven check happy
uds5501 e2e64cf
fix binder tests
uds5501 7002b47
Fix local module tests
uds5501 0d339e8
Remove check for log saves
uds5501 87cc328
missed removal
uds5501 53b18fe
missed removal - 2
uds5501 88aa31f
re add configuration for k8s task runner
uds5501 680182d
Revert "re add configuration for k8s task runner"
uds5501 ba273de
add indexing module to bind task logs
uds5501 5f1043d
address review comments.
uds5501 86aad85
accommodate nitpicks
uds5501 999d9c7
Merge branch 'master' of github.com:apache/druid into stopping_log_pu…
uds5501 e9e01fb
fix docker script
uds5501 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...-service/src/main/java/org/apache/druid/indexing/common/tasklogs/ExternalLogStreamer.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.druid.indexing.common.tasklogs; | ||
|
|
||
| import com.google.common.base.Optional; | ||
| import org.apache.druid.tasklogs.TaskLogStreamer; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
|
|
||
| public class ExternalLogStreamer implements TaskLogStreamer | ||
|
uds5501 marked this conversation as resolved.
Outdated
|
||
| { | ||
| @Override | ||
| public Optional<InputStream> streamTaskLog(String taskid, long offset) throws IOException | ||
| { | ||
| return Optional.absent(); | ||
| } | ||
| } | ||
104 changes: 104 additions & 0 deletions
104
...ing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/ExternalTaskLogs.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.druid.indexing.common.tasklogs; | ||
|
|
||
| import com.google.common.base.Optional; | ||
| import com.google.inject.Inject; | ||
| import com.google.inject.name.Named; | ||
| import org.apache.druid.java.util.emitter.EmittingLogger; | ||
| import org.apache.druid.tasklogs.TaskLogs; | ||
|
|
||
| import java.io.File; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
|
|
||
| public class ExternalTaskLogs implements TaskLogs | ||
|
uds5501 marked this conversation as resolved.
Outdated
|
||
| { | ||
| private static final EmittingLogger log = new EmittingLogger(ExternalTaskLogs.class); | ||
| private final TaskLogs delegate; | ||
| private final ExternalLogStreamer logStreamer; | ||
|
|
||
| @Inject | ||
| public ExternalTaskLogs(@Named("delegate") TaskLogs delegate, ExternalLogStreamer logStreamer) | ||
| { | ||
| this.delegate = delegate; | ||
| this.logStreamer = logStreamer; | ||
| } | ||
|
|
||
| @Override | ||
| public Optional<InputStream> streamTaskLog(String taskid, long offset) throws IOException | ||
| { | ||
| return logStreamer.streamTaskLog(taskid, offset); | ||
| } | ||
|
|
||
| @Override | ||
| public Optional<InputStream> streamTaskReports(final String taskid) throws IOException | ||
| { | ||
| return delegate.streamTaskReports(taskid); | ||
| } | ||
|
|
||
| @Override | ||
| public Optional<InputStream> streamTaskStatus(final String taskid) throws IOException | ||
| { | ||
| return delegate.streamTaskReports(taskid); | ||
| } | ||
|
|
||
| @Override | ||
| public void pushTaskLog(String taskid, File logFile) | ||
| { | ||
| log.debug("Skipping task log push for task[%s]", taskid); | ||
|
uds5501 marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| @Override | ||
| public void pushTaskPayload(String taskid, File taskPayloadFile) throws IOException | ||
| { | ||
| delegate.pushTaskPayload(taskid, taskPayloadFile); | ||
| } | ||
|
|
||
| @Override | ||
| public void killAll() throws IOException | ||
| { | ||
| delegate.killAll(); | ||
| } | ||
|
|
||
| @Override | ||
| public void killOlderThan(long timestamp) throws IOException | ||
| { | ||
| delegate.killOlderThan(timestamp); | ||
| } | ||
|
|
||
| @Override | ||
| public void pushTaskReports(String taskid, File reportFile) throws IOException | ||
| { | ||
| delegate.pushTaskReports(taskid, reportFile); | ||
| } | ||
|
|
||
| @Override | ||
| public void pushTaskStatus(String taskid, File reportFile) throws IOException | ||
| { | ||
| delegate.pushTaskStatus(taskid, reportFile); | ||
| } | ||
|
|
||
| @Override | ||
| public Optional<InputStream> streamTaskPayload(String taskid) throws IOException | ||
| { | ||
| return delegate.streamTaskPayload(taskid); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 can be a little confusing to have say these props set on the Overlord:
It is unclear why we need a delegate if we just wanted
FileTaskLogs.I think the intention is to direct task reports, status and payload to one place and logs to another.
So we need some kind of
switchingorcompositetask logs type, which would give us these props:With this, we just need a
SwitchingTaskLogsimplementation which takes in areportsTypeand alogsType, both of which would beTaskLogsimplementations.Uh oh!
There was an error while loading. Please reload this page.
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 ensure that extensions register themselves correctly as a valid type for say
druid.indexer.logs.switching.logsType, you would need to add a utility method inBinders, saybindTaskLogsand invoke it from all the relevant extension modules.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 options I am trying to provide here is different implementations of
logStoragevslogStreaming, maybe I could just extend this todruid.indexer.logs.switching.logs.storageanddruid.indexer.logs.switching.streaming?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 see. Yes, the same
switchingconcept can be extended for that use case as well.where
logsPushTypewould bind to aTaskLogPusherobject.and
logsStreamTypewould bind to aTaskLogStreamerobject.Would you still need to distinguish between reports and logs though?
Because I assume reports might need to be pushed to a different place.
If yes, you would still need a
druid.indexer.logs.switching.streaming.reportsType=noop/file/hdfsUh oh!
There was an error while loading. Please reload this page.
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.
This sounds good, in my head I am looking to provide the flexibility just for log types for now. The
delegated/reportTypecould take care of other task responsibilities. So finally, imo it should look like one of these.Option 1 [asking for explicit types for each responsibility]
translating to
or we could create one like
Option 2 [just keeping log handler separate while keeping the rest of the responsibilities with the delegate class]
I am personally leaning towards option 2 given the usecase in hand. what do you folks think?
EDIT: managed to make it work with a single
SwitchingTaskLogswith factory. I've added the implementation in this PR for the same.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.
@uds5501 , I don't think we need two levels of a switching implementation. That would really complicate the configs.
You can provide some decent defaults
When
druid.indexer.logs.type=switchingdruid.indexer.logs.switching.defaultTypefiledruid.indexer.logs.switching.logPushTypedefaultTypedruid.indexer.logs.switching.logStreamTypedefaultTypedruid.indexer.logs.switching.reportsTypedefaultTypeI don't think report and payload will ever need to be different.
If needed, we can add it in the future.
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, I see, will use this.
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.
Using this combination noew.