-
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
feat: new getLog task #1059
feat: new getLog task #1059
Conversation
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.
Maybe add a metric with the number of lines.
c3e7db2
to
838f608
Compare
838f608
to
05cd340
Compare
) | ||
} | ||
) | ||
public class Fetch extends Task implements RunnableTask<Fetch.Output> { |
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 need to support the executionId
like in Email or Slack Notification.
People use trigger flows for notification most of the time, and they want to get the log from an previous execution.
public Output run(RunContext runContext) throws Exception { | ||
String executionId = (String) new HashMap<>((Map<String, Object>) runContext.getVariables().get("execution")).get("id"); | ||
LogRepositoryInterface logRepository = runContext.getApplicationContext().getBean(LogRepositoryInterface.class); | ||
List<LogEntry> logs = new ArrayList<>(); |
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 are mounting the full log in memory with this, you need to flush the data directly on the filesystems
LogRepositoryInterface logRepository = runContext.getApplicationContext().getBean(LogRepositoryInterface.class); | ||
List<LogEntry> logs = new ArrayList<>(); | ||
|
||
if(this.tasksId != null){ |
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.
Best is to used the find(
to avoid mounting the whole data in memory
3e93a64
to
6aee866
Compare
@@ -358,6 +358,7 @@ subprojects { | |||
|
|||
task sourcesJar(type: Jar) { | |||
dependsOn = [':core:copyGradleProperties'] | |||
dependsOn = [':ui:assembleFrontend'] |
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.
Is it needed or is it a leftover of something else ?
Seems not related to this PR
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.
Probably leftover of this : f4e378c
public class Fetch extends Task implements RunnableTask<Fetch.Output> { | ||
|
||
@Schema( | ||
title = "Filter on specific execution" |
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.
Add a description explaining that if empty we will fetch the log of the current execution.
|
||
@Override | ||
public Output run(RunContext runContext) throws Exception { | ||
String executionId = this.executionId != null ? runContext.render(this.executionId) : (String) new HashMap<>((Map<String, Object>) runContext.getVariables().get("execution")).get("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.
Why do you create a new HashMap ? You should be able to get the execution ID directly from the map returned but the get("execution")
@Getter | ||
public static class Output implements io.kestra.core.models.tasks.Output { | ||
@Schema( | ||
title = "The size of the rows fetch" |
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.
title = "The size of the rows fetch" | |
title = "The size of the fetched rows" |
private Long size; | ||
|
||
@Schema( | ||
title = "The uri of store result", |
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.
title = "The uri of store result", | |
title = "The uri of stored results", |
6aee866
to
fab714e
Compare
fab714e
to
0e101c7
Compare
No description provided.