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

🐛 cron/workspace-cleaner: only run task for docker environments #17168

Merged
merged 6 commits into from
Sep 29, 2022

Conversation

pedroslopez
Copy link
Contributor

@pedroslopez pedroslopez commented Sep 26, 2022

What

Running cron on a kubernetes environment was causing an error when executing the WorkspaceCleaner:

2022-09-23 19:39:59 ERROR i.m.s.DefaultTaskExceptionHandler(handle):47 - Error invoking scheduled task for bean [io.airbyte.cron.selfhealing.WorkspaceCleaner@774358c5] /workspace
java.nio.file.NoSuchFileException: /workspace
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
	at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55) ~[?:?]
	at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:148) ~[?:?]
	at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99) ~[?:?]
	at java.nio.file.Files.readAttributes(Files.java:1849) ~[?:?]
	at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:220) ~[?:?]
	at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:277) ~[?:?]
	at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:323) ~[?:?]
	at java.nio.file.FileTreeIterator.<init>(FileTreeIterator.java:71) ~[?:?]
	at java.nio.file.Files.walk(Files.java:3917) ~[?:?]
	at java.nio.file.Files.walk(Files.java:3972) ~[?:?]
	at io.airbyte.cron.selfhealing.WorkspaceCleaner.deleteOldFiles(WorkspaceCleaner.java:51) ~[io.airbyte-airbyte-cron-0.40.6.jar:?]
	at io.airbyte.cron.selfhealing.$WorkspaceCleaner$Definition$Exec.dispatch(Unknown Source) ~[io.airbyte-airbyte-cron-0.40.6.jar:?]
	at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:378) ~[micronaut-inject-3.6.3.jar:3.6.3]
	at io.micronaut.inject.DelegatingExecutableMethod.invoke(DelegatingExecutableMethod.java:76) ~[micronaut-inject-3.6.3.jar:3.6.3]
	at io.micronaut.scheduling.processor.ScheduledMethodProcessor.lambda$process$5(ScheduledMethodProcessor.java:127) ~[micronaut-context-3.6.3.jar:3.6.3]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577) ~[?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.lang.Thread.run(Thread.java:1589) ~[?:?]

How

Since this is only intended to run on docker contexts, use the micronaut environment to determine if the task should run.

@pedroslopez pedroslopez temporarily deployed to more-secrets September 26, 2022 20:48 Inactive
Copy link
Contributor

@gosusnp gosusnp left a comment

Choose a reason for hiding this comment

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

The require part looks good to me. I am not sure about the config itself, we had some discussions about that.
@benmoriceau, what do you think?

Copy link
Contributor

@benmoriceau benmoriceau left a comment

Choose a reason for hiding this comment

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

LGTM but we need to add the new env variable to the file kube/overlays/resources/cron.yml .

And we will need to make sure that the helm chart have this value as well when they got created.

@pedroslopez pedroslopez temporarily deployed to more-secrets September 29, 2022 18:19 Inactive
@github-actions github-actions bot added area/platform issues related to the platform kubernetes labels Sep 29, 2022
@pedroslopez
Copy link
Contributor Author

@benmoriceau Added to kube/resources/cron.yml in bbe301b

@pedroslopez pedroslopez temporarily deployed to more-secrets September 29, 2022 18:23 Inactive
@github-actions github-actions bot removed kubernetes area/platform issues related to the platform labels Sep 29, 2022
@pedroslopez
Copy link
Contributor Author

Updated to use micronaut environments cc @jdpgrailsdev

@pedroslopez pedroslopez temporarily deployed to more-secrets September 29, 2022 18:50 Inactive
Copy link
Contributor

@jdpgrailsdev jdpgrailsdev left a comment

Choose a reason for hiding this comment

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

:shipit:

@pedroslopez pedroslopez merged commit 12b4669 into master Sep 29, 2022
@pedroslopez pedroslopez deleted the pedroslopez/cron-cleanup-deployment-mode branch September 29, 2022 19:53
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
…ytehq#17168)

* dont run cleanup on kubernetes

* use the micronaut way™

* add env var to kube resource

* use micronaut environment instead

* no need for the env var
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.

4 participants