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

Add custom JAVA_TOOL_OPTIONS by SdkRunnableTask #238

Merged
merged 2 commits into from
Aug 1, 2023

Conversation

andresgomezfrr
Copy link
Collaborator

@andresgomezfrr andresgomezfrr commented Jul 31, 2023

Read then delete this section

Allow configuring custom JAVA_TOOL_OPTIONS by SdkRunnableTask

Tests

I tested it manually and it worked fine:
Screenshot 2023-07-31 at 13 29 08

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Issue

flyteorg/flyte#3910

@andresgomezfrr andresgomezfrr marked this pull request as ready for review July 31, 2023 11:22
Copy link
Member

@honnix honnix left a comment

Choose a reason for hiding this comment

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

Minor comments, otherwise LGTM.

@honnix
Copy link
Member

honnix commented Jul 31, 2023

Please create an issue and reference to it for visibility, as this is a pretty useful new feature.

@andresgomezfrr andresgomezfrr force-pushed the add-custom-java-tool-options branch 3 times, most recently from 46c2eef to 3563166 Compare July 31, 2023 13:59

@Override
public List<String> getCustomJavaToolOptions() {
return sdkTask.getCustomJavaToolOptions();
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, this is actually problematic. flytekit-java is shipped from user code space, which means for existing code, getCustomJavaToolOptions does not exist in SdkRunnableTask. So here for now we need to use reflection to check existence of this method, until we migrate all users.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right... this is the case where a user uses an old version of flytekit-java and tries to register with a new version of it, right?

Copy link
Member

Choose a reason for hiding this comment

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

Let's me think about it. It may not be a problem. I need to check how jflyte works.

Copy link
Member

Choose a reason for hiding this comment

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

Forgot about my previous comment. I somehow thought this code was in jflyte module.

I think we will need to have default implementation in RunnableTask after all. jflyte will use flytekit-java module from user code space when registering because of ChildFirstClassLoader, so when processing old version where RunnableTaskImpl does not have getCustomJavaToolOptions, ProjectClosure will fail when calling task.getCustomJavaToolOptions(), or maybe even earlier because old RunnableTaskImpl does not really implement new RunnableTask if there is no default implementation.

It might come as a common rule that there must be default implementation in RunnableTask whenever we extend it, so the existing FIXMEs are not telling the truth.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

so.. in this case, should I remove all the FIXME comments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tested it using the old flytekit-java in the user repo and registered the task with the new flytekit-java container and with the default property, everything worked fine.

Copy link
Member

Choose a reason for hiding this comment

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

so.. in this case, should I remove all the FIXME comments?

I think it makes sense. It is rather simple to keep the defaults than asking users to migrate, and the migration itself doesn't bring much value anyway.

Copy link
Member

Choose a reason for hiding this comment

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

I tested it using the old flytekit-java in the user repo and registered the task with the new flytekit-java container and with the default property, everything worked fine.

Great. Sorry I gave wrong direction in an early comment. I did not think carefully about those "FIXME"s .

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Don't worry! so.. looks good to you the PR now?

Copy link
Member

@honnix honnix left a comment

Choose a reason for hiding this comment

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

This breaks backward compatibility. Please check my comment https://github.com/flyteorg/flytekit-java/pull/238/files#r1279358563.

Signed-off-by: Andres Gomez Ferrer <[email protected]>
@honnix
Copy link
Member

honnix commented Aug 1, 2023

There are some test failures.

@andresgomezfrr
Copy link
Collaborator Author

There are some test failures.

yes... I just saw this.. checking

@andresgomezfrr
Copy link
Collaborator Author

There are some test failures.

I think that this test return a duplicated 😮

[ERROR] Failures: 
[ERROR]   SdkNodeNamePolicyTest.nextNodeIdShouldReturnUniquePrefixForDistinctPolicies:71 returned duplicated prefix
Expected: a collection with size <9>
     but: collection size was <10>
  @Test
  void nextNodeIdShouldReturnUniquePrefixForDistinctPolicies() {
    var prefixes =
        Stream.generate(SdkNodeNamePolicy::new)
            .limit(10)
            .map(SdkNodeNamePolicy::nextNodeId)
            .map(SdkNodeNamePolicyTest::prefix)
            .collect(toList());
    var uniquePrefixes = Set.copyOf(prefixes);

    assertThat("returned duplicated prefix", prefixes, hasSize(uniquePrefixes.size()));
  }

@andresgomezfrr andresgomezfrr merged commit 1850f16 into master Aug 1, 2023
3 checks passed
@andresgomezfrr andresgomezfrr deleted the add-custom-java-tool-options branch August 1, 2023 07:58
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.

2 participants