-
Notifications
You must be signed in to change notification settings - Fork 948
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
Updated time duration to 30 seconds #5594
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8c52603
Updated time duration to 30 seconds
yoyounik 97eab40
added Wait.java class, wait-task-flow.yaml
yoyounik 4efe91a
Merge branch 'develop' into add-sleep-task
yoyounik 7acc11e
updated the duration and added all other changes except test
yoyounik 618dcbc
added the waitTaskTest method for testing
yoyounik 76042b4
removed sleep-task.yml changes
yoyounik cb0e67d
removed the type with id: wait
yoyounik 6b6a4d6
removed the type with id: wait
yoyounik 3771ca9
removed the yaml file update the type
yoyounik 70a891f
Wait.java changed to Sleep.java,
yoyounik c8b5e88
fix(*): polishing
Skraye 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 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,55 @@ | ||
package io.kestra.plugin.core.debug; | ||
|
||
import io.kestra.core.models.annotations.Example; | ||
import io.kestra.core.models.annotations.Plugin; | ||
import io.kestra.core.models.annotations.PluginProperty; | ||
import io.kestra.core.models.tasks.Task; | ||
import io.kestra.core.runners.RunContext; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.time.Duration; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
@SuperBuilder | ||
@ToString | ||
@EqualsAndHashCode | ||
@Getter | ||
@NoArgsConstructor | ||
@Schema( | ||
title = "A task that waits for a specified duration before proceeding." | ||
) | ||
@Plugin( | ||
examples = { | ||
@Example( | ||
code = """ | ||
id: wait | ||
type: io.kestra.plugin.core.debug.Wait | ||
yoyounik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
duration: "PT5S" | ||
""" | ||
) | ||
} | ||
) | ||
public class Wait extends Task { | ||
@Schema( | ||
title = "Duration to wait", | ||
description = "The time duration in ISO-8601 format (e.g., `PT5S` for 5 seconds)." | ||
) | ||
@PluginProperty | ||
@NotNull | ||
private Duration duration; | ||
|
||
public Void run(RunContext runContext) throws Exception { | ||
runContext.logger().info("Waiting for {}", duration); | ||
|
||
// Wait for the specified duration | ||
TimeUnit.MILLISECONDS.sleep(duration.toMillis()); | ||
|
||
return null; | ||
} | ||
} |
This file contains 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 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,17 @@ | ||
id: wait-task-flow | ||
namespace: io.kestra.tests | ||
|
||
tasks: | ||
- id: wait | ||
type: io.kestra.plugin.core.debug.Wait | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong type |
||
delay: PT10S # Waits for 10 seconds before proceeding | ||
|
||
- id: next-task | ||
type: io.kestra.plugin.core.scripts.Shell | ||
commands: | ||
- echo "Wait task completed" | ||
|
||
triggers: | ||
yoyounik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- id: schedule | ||
type: io.kestra.plugin.core.trigger.Schedule | ||
cron: "0 * * * *" |
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.
The package is not the good one, here is the one asked in the original issue :
io.kestra.plugin.core.flow.Sleep
with
io.kestra.plugin.core.flow
being the package andSleep
being the class nameand this will form the task type
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.
@yoyounik Please read this, better take your times to make correct changes once than doing it 10 times
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.
@Skraye I apologize for the repeated mistakes. I will take my time to ensure that the changes are correct before submitting them again.
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.
Hi @Skraye
Thanks for the feedback. You're right, "Sleep" might be a more descriptive name for the class.
I can rename the Wait.java class to Sleep.java and update the code accordingly. This would keep the file in the io.kestra.plugin.core.flow package.
Does that sound like a good approach?
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 is exactly what's need to be done 👍
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.
okay then i will rename it and update you @Skraye
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.
Hey @Skraye
changes i made:
Wait.java changed to Sleep.java,
wait-task-flow.yml changed to sleep-task-flow.yml and changes inside it to Sleep.
sleep.yml's type has been changed.
going to update these changes now, please go through this once, and thanks for the patience shown :).
Please update me if any changes required.