Package org.apache.druid.tasklogs
Class SwitchingTaskLogs
java.lang.Object
org.apache.druid.tasklogs.SwitchingTaskLogs
- All Implemented Interfaces:
TaskLogKiller,TaskLogPusher,TaskLogs,TaskLogStreamer,TaskPayloadManager
Implements
TaskLogs by delegating to different task log providers based on the functionality required.
This allows for different handling of reports, streaming logs, and pushing logs with a default fallback.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSwitchingTaskLogs(TaskLogs defaultDelegate, TaskLogs reportsDelegate, TaskLogs logStreamer, TaskLogs logPusher) -
Method Summary
Modifier and TypeMethodDescriptionvoidkillAll()voidkillOlderThan(long timestamp) Removes logs older than the provided timestampvoidpushTaskLog(String taskid, File logFile) voidpushTaskPayload(String taskid, File taskPayloadFile) Save payload so it can be retrieved later.voidpushTaskReports(String taskid, File reportFile) voidpushTaskStatus(String taskid, File reportFile) com.google.common.base.Optional<InputStream> streamTaskLog(String taskid, long offset) Stream log for a task.com.google.common.base.Optional<InputStream> streamTaskPayload(String taskid) Stream payload for a task.com.google.common.base.Optional<InputStream> streamTaskReports(String taskid) com.google.common.base.Optional<InputStream> streamTaskStatus(String taskid)
-
Field Details
-
PROPERTY_PREFIX
- See Also:
-
PROPERTY_DEFAULT_TYPE
- See Also:
-
PROPERTY_LOG_PUSH_TYPE
- See Also:
-
PROPERTY_LOG_STREAM_TYPE
- See Also:
-
PROPERTY_REPORTS_TYPE
- See Also:
-
NAME_REPORTS_TYPE
- See Also:
-
NAME_LOG_STREAM_TYPE
- See Also:
-
NAME_LOG_PUSH_TYPE
- See Also:
-
NAME_DEFAULT_TYPE
- See Also:
-
-
Constructor Details
-
SwitchingTaskLogs
-
-
Method Details
-
streamTaskLog
public com.google.common.base.Optional<InputStream> streamTaskLog(String taskid, long offset) throws IOException Description copied from interface:TaskLogStreamerStream log for a task.- Specified by:
streamTaskLogin interfaceTaskLogStreamer- Parameters:
offset- If zero, stream the entire log. If positive, attempt to read from this position onwards. If negative, attempt to read this many bytes from the end of the file (like tail -n).- Returns:
- inputStream for this log, if available
- Throws:
IOException
-
streamTaskReports
public com.google.common.base.Optional<InputStream> streamTaskReports(String taskid) throws IOException - Specified by:
streamTaskReportsin interfaceTaskLogStreamer- Throws:
IOException
-
streamTaskStatus
public com.google.common.base.Optional<InputStream> streamTaskStatus(String taskid) throws IOException - Specified by:
streamTaskStatusin interfaceTaskLogStreamer- Throws:
IOException
-
pushTaskLog
- Specified by:
pushTaskLogin interfaceTaskLogPusher- Throws:
IOException
-
pushTaskPayload
Description copied from interface:TaskPayloadManagerSave payload so it can be retrieved later.- Specified by:
pushTaskPayloadin interfaceTaskPayloadManager- Throws:
IOException
-
killAll
- Specified by:
killAllin interfaceTaskLogKiller- Throws:
IOException
-
killOlderThan
Description copied from interface:TaskLogKillerRemoves logs older than the provided timestamp- Specified by:
killOlderThanin interfaceTaskLogKiller- Parameters:
timestamp- Timestamp in milliseconds- Throws:
IOException
-
pushTaskReports
- Specified by:
pushTaskReportsin interfaceTaskLogPusher- Throws:
IOException
-
pushTaskStatus
- Specified by:
pushTaskStatusin interfaceTaskLogPusher- Throws:
IOException
-
streamTaskPayload
public com.google.common.base.Optional<InputStream> streamTaskPayload(String taskid) throws IOException Description copied from interface:TaskPayloadManagerStream payload for a task.- Specified by:
streamTaskPayloadin interfaceTaskPayloadManager- Returns:
- inputStream for this taskPayload, if available
- Throws:
IOException
-