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

[Fix] Fix spark/flink starter script error on windows #6435

Closed
wants to merge 21 commits into from
Closed

[Fix] Fix spark/flink starter script error on windows #6435

wants to merge 21 commits into from

Conversation

GangLiCN
Copy link

@GangLiCN GangLiCN commented Mar 2, 2024

This PR is to fix seatunnel issue 6386

Does this PR introduce any user-facing change?

No

How was this patch tested?

This pach can be tested via general windows specific flink/spark starter script.
Flink: start-seatunnel-flink-13(15)-connector-v2.cmd
Spark: start-seatunnel-spark-2(3)-connector-v2.cmd

For conf file, just using the example conf file from "seatunnel_home/config" dir.
v2.batch.config.template, v2.streaming.template

Check list

The purpose of this commit is to fix spark & flink job submit issue on windows platform.
Add more comments after last change..
os_type="Windows";
} else if (SystemUtils.IS_OS_MAC) {
os_type="Mac";
} else if (SystemUtils.IS_OS_LINUX) {
Copy link
Contributor

Choose a reason for hiding this comment

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

switch?

Copy link
Author

Choose a reason for hiding this comment

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

Do you mean change the code to the code style "switch ... case" ? If this is true, I'll modify as you suggested.

Copy link
Author

Choose a reason for hiding this comment

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

I don't think "switch... case" is needed here, because there are many different properties from SystemUtils(e.g. IS_OS_LINUX, IS_OS_WINDOWS,,,etc), if SystemUtils can return unique property "OS_TYPE" then we can change to Switch... case style easily.

Comment on lines 69 to 75
if (local_os_type.toLowerCase().equals("windows")) {
cmd_flink="%FLINK_HOME%/bin/flink.cmd";
} else if (local_os_type.toLowerCase().equals("linux")) {
cmd_flink="${FLINK_HOME}/bin/flink";
} else if (local_os_type.toLowerCase().equals("unknown")) {
cmd_flink="error";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Author

Choose a reason for hiding this comment

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

fixed .

Comment on lines 210 to 216
if (local_os_type.toLowerCase().equals("windows")) {
cmd_spark="%SPARK_HOME%/bin/spark-submit.cmd";
} else if (local_os_type.toLowerCase().equals("linux")) {
cmd_spark="${SPARK_HOME}/bin/spark-submit";
} else if (local_os_type.toLowerCase().equals("unknown")) {
cmd_spark="error";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Author

Choose a reason for hiding this comment

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

fixed.

@Hisoka-X Hisoka-X added the bug label Mar 5, 2024
@Hisoka-X Hisoka-X changed the title [Bugfix][seatunnel--flink/spark-starter-common] [Fix] Fix spark/flink starter script error on windows Mar 5, 2024
Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

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

Please add test in e2e.

@Hisoka-X Hisoka-X added the First-time contributor First-time contributor label Mar 6, 2024
@GangLiCN
Copy link
Author

GangLiCN commented Mar 7, 2024

Please add test in e2e.

Hi, please tell me the full detailed steps for "add test in e2e" since I'm fresh on this.

Bases on my understanding, it seems that it's unnecessary to add new test cases because current test case is enoguh to cover the bug fix. As I mentioned before, we can verify the fix like below:
"
The fix can be tested via general windows specific flink/spark starter script.
Flink: start-seatunnel-flink-13(15)-connector-v2.cmd
Spark: start-seatunnel-spark-2(3)-connector-v2.cmd

For conf file, just using the example conf file from "seatunnel_home/config" dir.
v2.batch.config.template, v2.streaming.template
"

@Hisoka-X
Copy link
Member

Hisoka-X commented Mar 7, 2024

Please add test in e2e.

Hi, please tell me the full detailed steps for "add test in e2e" since I'm fresh on this.

Bases on my understanding, it seems that it's unnecessary to add new test cases because current test case is enoguh to cover the bug fix. As I mentioned before, we can verify the fix like below: " The fix can be tested via general windows specific flink/spark starter script. Flink: start-seatunnel-flink-13(15)-connector-v2.cmd Spark: start-seatunnel-spark-2(3)-connector-v2.cmd

For conf file, just using the example conf file from "seatunnel_home/config" dir. v2.batch.config.template, v2.streaming.template "

Oh I see. How about add some UT to verify whether the output command is right. Our UT will exeucted both on windows and linux.

@GangLiCN
Copy link
Author

GangLiCN commented Mar 7, 2024

Please add test in e2e.

Hi, please tell me the full detailed steps for "add test in e2e" since I'm fresh on this.
Bases on my understanding, it seems that it's unnecessary to add new test cases because current test case is enoguh to cover the bug fix. As I mentioned before, we can verify the fix like below: " The fix can be tested via general windows specific flink/spark starter script. Flink: start-seatunnel-flink-13(15)-connector-v2.cmd Spark: start-seatunnel-spark-2(3)-connector-v2.cmd
For conf file, just using the example conf file from "seatunnel_home/config" dir. v2.batch.config.template, v2.streaming.template "

Oh I see. How about add some UT to verify whether the output command is right. Our UT will exeucted both on windows and linux.

What does UT mean ? user testcase ?

@Hisoka-X
Copy link
Member

Hisoka-X commented Mar 7, 2024

Please add test in e2e.

Hi, please tell me the full detailed steps for "add test in e2e" since I'm fresh on this.
Bases on my understanding, it seems that it's unnecessary to add new test cases because current test case is enoguh to cover the bug fix. As I mentioned before, we can verify the fix like below: " The fix can be tested via general windows specific flink/spark starter script. Flink: start-seatunnel-flink-13(15)-connector-v2.cmd Spark: start-seatunnel-spark-2(3)-connector-v2.cmd
For conf file, just using the example conf file from "seatunnel_home/config" dir. v2.batch.config.template, v2.streaming.template "

Oh I see. How about add some UT to verify whether the output command is right. Our UT will exeucted both on windows and linux.

What does UT mean ? user testcase ?

unit test. you can refer

so on

@GangLiCN
Copy link
Author

GangLiCN commented Mar 7, 2024

Please add test in e2e.

Hi, please tell me the full detailed steps for "add test in e2e" since I'm fresh on this.
Bases on my understanding, it seems that it's unnecessary to add new test cases because current test case is enoguh to cover the bug fix. As I mentioned before, we can verify the fix like below: " The fix can be tested via general windows specific flink/spark starter script. Flink: start-seatunnel-flink-13(15)-connector-v2.cmd Spark: start-seatunnel-spark-2(3)-connector-v2.cmd
For conf file, just using the example conf file from "seatunnel_home/config" dir. v2.batch.config.template, v2.streaming.template "

Oh I see. How about add some UT to verify whether the output command is right. Our UT will exeucted both on windows and linux.

What does UT mean ? user testcase ?

unit test. you can refer

so on

I checked the source code of "TestFlinkParameter.java" and feel a bit confused.
It imports two new class:
import org.apache.seatunnel.core.starter.flink.args.FlinkCommandArgs;
import org.apache.seatunnel.core.starter.flink.utils.EnvironmentUtil;

I can't find these classes in dev branch of base repo(apache/seatunnel)'s code line,
Has these two java classes added recently ?

About this PR, Is it also necessary to introduce some new java classes to finish a simple unit test case ?
Do we have a guideline or standard rule to submit unit test case ?

@Hisoka-X
Copy link
Member

Hisoka-X commented Mar 7, 2024

I can't find these classes in dev branch of base repo(apache/seatunnel)'s code line,

You can search it
image

About this PR, Is it also necessary to introduce some new java classes to finish a simple unit test case ?

Yes, just create new java file with new test case. The TestFlinkParameter.java just a demo of unit test in seatunnel

@hailin0
Copy link
Contributor

hailin0 commented Mar 11, 2024

please merge dev branch update
6442

image

@hailin0
Copy link
Contributor

hailin0 commented Mar 11, 2024

Sorry, I made an error operation and I'm trying to recover it

@GangLiCN
Copy link
Author

I've finished java unit test cases and tested successfully.

BTW, I also fixed windows specific starter script errors(e.g. start-seatunnel-flink-15-connector-v2.cmd, start-seatunnel-spark-3-connector-v2.cmd) because in 2.3.4 release version running these scripts will trigger "JAVA CLASSNOTFOUNDEXCEPTION".

seatunnel_issue6386-fix- with_java_unit_test
pom.xml Outdated
@@ -55,7 +55,7 @@

<properties>
<!--todo The classification is too confusing, reclassify by type-->
<revision>2.3.5-SNAPSHOT</revision>
<revision>2.3.4</revision>
Copy link
Contributor

Choose a reason for hiding this comment

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

revert?

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I forgot to modify this file because on my local windows environment setting "2.3.5-SNAPSHOT" will cause build fails.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

@hailin0
Copy link
Contributor

hailin0 commented Mar 12, 2024

please merge dev branch update 6442 image

@GangLiCN
please fix it

@hailin0
Copy link
Contributor

hailin0 commented Mar 14, 2024

image

@hailin0
Copy link
Contributor

hailin0 commented Mar 14, 2024

If the merge conflict cannot be resolved, you can resubmit the PR

@GangLiCN GangLiCN closed this by deleting the head repository Mar 14, 2024
@GangLiCN
Copy link
Author

I closed this PR and submitted a new PR:
#6511

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug First-time contributor First-time contributor
Projects
None yet
4 participants