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

feat: new log task to replace echo task #1055

Merged
merged 4 commits into from
Mar 16, 2023
Merged

feat: new log task to replace echo task #1055

merged 4 commits into from
Mar 16, 2023

Conversation

Skraye
Copy link
Member

@Skraye Skraye commented Mar 10, 2023

Write a new log task with a more explicit property that accepts String but also an Array of String.
No tests were written for the echo task. Should I write one for the log task?

close #1046

@Skraye Skraye requested a review from loicmathieu March 10, 2023 10:54
Copy link
Member

@tchiotludo tchiotludo left a comment

Choose a reason for hiding this comment

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

You should also remove old the usage of the deprecated Task on the core (java + yaml), If we want to properly remove one day the task

@tchiotludo tchiotludo force-pushed the develop branch 2 times, most recently from 0f6a784 to 320c925 Compare March 13, 2023 10:39
@Skraye Skraye force-pushed the feat/log-task branch 2 times, most recently from 32aa057 to 9cda02c Compare March 13, 2023 11:19
Copy link
Member

@loicmathieu loicmathieu left a comment

Choose a reason for hiding this comment

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

Can you add something in the description of the Echo task to say that it's deprecated and replaced by the new Log task ?

@Getter
@NoArgsConstructor
@Schema(
title = "Simple debugging task that log a renderer value.",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
title = "Simple debugging task that log a renderer value.",
title = "Task that log a message in the execution log.",

Comment on lines 30 to 31
description = "This task is mostly useful for debugging purpose.\n\n" +
"This one allow you to logs inputs or outputs variables for example, or to debug some templated functions."
Copy link
Member

Choose a reason for hiding this comment

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

I think you can remove this description, people know the purpose of a log

description = "Can be a string or an array of string",
anyOf = {
String.class,
ArrayList.class
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ArrayList.class
String[].class

Copy link
Member

Choose a reason for hiding this comment

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

Thanks to this the JSON schema will know that the item in the list must be strings

String render = runContext.render((String) this.message);
this.log(logger, this.level, render);
} else if (this.message instanceof Collection) {
ArrayList<String> messages = (ArrayList<String>) this.message;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ArrayList<String> messages = (ArrayList<String>) this.message;
Collection<String> messages = (Collection<String>) this.message;

Copy link
Member

Choose a reason for hiding this comment

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

Don't cast on implementation, always prefere to use the interface.
If Collection didn't fit, use List instead.
It's a principle called "coding against interface"

@@ -0,0 +1,116 @@
package io.kestra.core.tasks.debugs;
Copy link
Member

Choose a reason for hiding this comment

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

Should be in the log package not the debug package (the same where the Fetch task will be)

@tchiotludo tchiotludo merged commit e520402 into develop Mar 16, 2023
@tchiotludo tchiotludo deleted the feat/log-task branch March 16, 2023 17:01
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.

Rename the Echo task to Log
3 participants