Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
7ea8cab6
Unverified
Commit
7ea8cab6
authored
Dec 12, 2023
by
aiwenmo
Committed by
GitHub
Dec 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature-2622][core] Local task supports cancel (#2623)
Co-authored-by:
wenmo
<
32723967+wenmo@users.noreply.github.com
>
parent
963cb1d2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
3 deletions
+23
-3
Job2MysqlHandler.java
...src/main/java/org/dinky/job/handler/Job2MysqlHandler.java
+1
-1
ClusterInstanceServiceImpl.java
...va/org/dinky/service/impl/ClusterInstanceServiceImpl.java
+3
-0
TaskServiceImpl.java
...src/main/java/org/dinky/service/impl/TaskServiceImpl.java
+6
-0
IpUtils.java
dinky-admin/src/main/java/org/dinky/utils/IpUtils.java
+11
-0
URLUtils.java
dinky-common/src/main/java/org/dinky/utils/URLUtils.java
+1
-1
JobConfig.java
dinky-core/src/main/java/org/dinky/job/JobConfig.java
+1
-1
No files found.
dinky-admin/src/main/java/org/dinky/job/handler/Job2MysqlHandler.java
View file @
7ea8cab6
...
@@ -129,7 +129,7 @@ public class Job2MysqlHandler implements JobHandler {
...
@@ -129,7 +129,7 @@ public class Job2MysqlHandler implements JobHandler {
history
.
setStatus
(
job
.
getStatus
().
getCode
());
history
.
setStatus
(
job
.
getStatus
().
getCode
());
history
.
setJobId
(
job
.
getJobId
());
history
.
setJobId
(
job
.
getJobId
());
history
.
setEndTime
(
job
.
getEndTime
());
history
.
setEndTime
(
job
.
getEndTime
());
history
.
setJobManagerAddress
(
job
.
isUseGateway
()
?
job
.
getJobManagerAddress
()
:
null
);
history
.
setJobManagerAddress
(
job
.
getJobManagerAddress
()
);
Integer
clusterId
=
job
.
getJobConfig
().
getClusterId
();
Integer
clusterId
=
job
.
getJobConfig
().
getClusterId
();
ClusterInstance
clusterInstance
;
ClusterInstance
clusterInstance
;
...
...
dinky-admin/src/main/java/org/dinky/service/impl/ClusterInstanceServiceImpl.java
View file @
7ea8cab6
...
@@ -100,6 +100,9 @@ public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstance
...
@@ -100,6 +100,9 @@ public class ClusterInstanceServiceImpl extends SuperServiceImpl<ClusterInstance
port
=
Integer
.
valueOf
(
flinkConfig
.
get
(
"rest.port"
));
port
=
Integer
.
valueOf
(
flinkConfig
.
get
(
"rest.port"
));
}
else
{
}
else
{
port
=
URLUtils
.
getRandomPort
();
port
=
URLUtils
.
getRandomPort
();
while
(!
IpUtils
.
isPortAvailable
(
port
))
{
port
=
URLUtils
.
getRandomPort
();
}
}
}
return
buildLocalEnvironmentAddress
(
port
);
return
buildLocalEnvironmentAddress
(
port
);
}
}
...
...
dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java
View file @
7ea8cab6
...
@@ -225,7 +225,13 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
...
@@ -225,7 +225,13 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
config
.
setClusterId
(
jobInstance
.
getClusterId
());
config
.
setClusterId
(
jobInstance
.
getClusterId
());
}
}
}
else
if
(
GatewayType
.
LOCAL
.
equalsValue
(
task
.
getType
()))
{
}
else
if
(
GatewayType
.
LOCAL
.
equalsValue
(
task
.
getType
()))
{
if
(
task
.
getJobInstanceId
()
==
null
)
{
config
.
setClusterId
(
null
);
config
.
setClusterId
(
null
);
}
else
{
JobInstance
jobInstance
=
jobInstanceService
.
getById
(
task
.
getJobInstanceId
());
config
.
setClusterId
(
jobInstance
.
getClusterId
());
config
.
setUseRemote
(
true
);
}
config
.
setClusterConfigurationId
(
null
);
config
.
setClusterConfigurationId
(
null
);
}
else
{
}
else
{
Optional
.
ofNullable
(
task
.
getClusterId
()).
ifPresent
(
config:
:
setClusterId
);
Optional
.
ofNullable
(
task
.
getClusterId
()).
ifPresent
(
config:
:
setClusterId
);
...
...
dinky-admin/src/main/java/org/dinky/utils/IpUtils.java
View file @
7ea8cab6
...
@@ -22,6 +22,7 @@ package org.dinky.utils;
...
@@ -22,6 +22,7 @@ package org.dinky.utils;
import
org.dinky.assertion.Asserts
;
import
org.dinky.assertion.Asserts
;
import
java.net.InetAddress
;
import
java.net.InetAddress
;
import
java.net.ServerSocket
;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -171,6 +172,16 @@ public class IpUtils {
...
@@ -171,6 +172,16 @@ public class IpUtils {
return
"127.0.0.1"
;
return
"127.0.0.1"
;
}
}
public
static
boolean
isPortAvailable
(
int
port
)
{
try
(
ServerSocket
serverSocket
=
new
ServerSocket
(
port
))
{
// If the code reaches this point, the port is available
return
true
;
}
catch
(
Exception
e
)
{
// Port is not available
return
false
;
}
}
public
static
String
getHostName
()
{
public
static
String
getHostName
()
{
try
{
try
{
return
InetAddress
.
getLocalHost
().
getHostName
();
return
InetAddress
.
getLocalHost
().
getHostName
();
...
...
dinky-common/src/main/java/org/dinky/utils/URLUtils.java
View file @
7ea8cab6
...
@@ -107,6 +107,6 @@ public class URLUtils {
...
@@ -107,6 +107,6 @@ public class URLUtils {
public
static
int
getRandomPort
()
{
public
static
int
getRandomPort
()
{
Random
random
=
new
Random
();
Random
random
=
new
Random
();
return
random
.
nextInt
(
6
5536
);
return
30000
+
random
.
nextInt
(
3
5536
);
}
}
}
}
dinky-core/src/main/java/org/dinky/job/JobConfig.java
View file @
7ea8cab6
...
@@ -237,7 +237,7 @@ public class JobConfig {
...
@@ -237,7 +237,7 @@ public class JobConfig {
}
}
public
boolean
isUseRemote
()
{
public
boolean
isUseRemote
()
{
return
!
GatewayType
.
LOCAL
.
equalsValue
(
type
);
return
useRemote
||
!
GatewayType
.
LOCAL
.
equalsValue
(
type
);
}
}
public
void
buildLocal
()
{
public
void
buildLocal
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment