Skip to content

Commit

Permalink
[Hotfix][APP] Fix job config file generation path error in windows (#140
Browse files Browse the repository at this point in the history
)

* [fit][seatunnel-app]
      Modify configuration file generation path rules to adapt to windows and linux

* [refactor][APP]
      Modify exception logs
  • Loading branch information
dbac authored Oct 27, 2023
1 parent cfc5870 commit 8d0c436
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.seatunnel.app.thirdparty.metrics.IEngineMetricsExtractor;
import org.apache.seatunnel.common.config.Common;
import org.apache.seatunnel.common.config.DeployMode;
import org.apache.seatunnel.common.utils.ExceptionUtils;
import org.apache.seatunnel.engine.client.SeaTunnelClient;
import org.apache.seatunnel.engine.client.job.ClientJobProxy;
import org.apache.seatunnel.engine.client.job.JobExecutionEnvironment;
Expand Down Expand Up @@ -76,7 +77,8 @@ public Result<Long> jobExecute(Integer userId, Long jobDefineId) {

public String writeJobConfigIntoConfFile(String jobConfig, Long jobDefineId) {
String projectRoot = System.getProperty("user.dir");
String filePath = projectRoot + "\\profile\\" + jobDefineId + ".conf";
String filePath =
projectRoot + File.separator + "profile" + File.separator + jobDefineId + ".conf";
try {
File file = new File(filePath);
if (!file.exists()) {
Expand Down Expand Up @@ -120,6 +122,7 @@ public Long executeJobBySeaTunnel(Integer userId, String filePath, Long jobInsta
});

} catch (ExecutionException | InterruptedException e) {
ExceptionUtils.getMessage(e);
throw new RuntimeException(e);
}
return jobInstanceId;
Expand Down Expand Up @@ -189,8 +192,14 @@ public Result<Void> jobStore(Integer userId, Long jobInstanceId) {
JobInstance jobInstance = jobInstanceDao.getJobInstance(jobInstanceId);

String projectRoot = System.getProperty("user.dir");
String filePath = projectRoot + "\\profile\\" + jobInstance.getJobDefineId() + ".conf";

String filePath =
projectRoot
+ File.separator
+ "profile"
+ File.separator
+ jobInstance.getJobDefineId()
+ ".conf";
log.info("jobStore filePath:{}", filePath);
SeaTunnelEngineProxy.getInstance()
.restoreJob(filePath, jobInstanceId, Long.valueOf(jobInstance.getJobEngineId()));
return Result.success();
Expand Down

0 comments on commit 8d0c436

Please sign in to comment.