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
3f9bf1c7
Unverified
Commit
3f9bf1c7
authored
Nov 23, 2023
by
gaoyan
Committed by
GitHub
Nov 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add console log when run debug (#2566)
* Optimize the process * add debug console log * formate code
parent
ad3f0df7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
8 deletions
+37
-8
ProcessAspect.java
dinky-admin/src/main/java/org/dinky/aop/ProcessAspect.java
+26
-3
TaskController.java
...in/src/main/java/org/dinky/controller/TaskController.java
+2
-1
DebugDTO.java
dinky-admin/src/main/java/org/dinky/data/dto/DebugDTO.java
+3
-0
TaskDTO.java
dinky-admin/src/main/java/org/dinky/data/dto/TaskDTO.java
+5
-3
ProcessId.java
...n/src/main/java/org/dinky/data/annotations/ProcessId.java
+1
-1
No files found.
dinky-admin/src/main/java/org/dinky/aop/ProcessAspect.java
View file @
3f9bf1c7
...
...
@@ -26,11 +26,13 @@ import org.dinky.data.annotations.ProcessStep;
import
org.dinky.data.enums.ProcessStatus
;
import
org.dinky.data.enums.ProcessStepType
;
import
org.dinky.data.enums.ProcessType
;
import
org.dinky.data.exception.DinkyException
;
import
org.dinky.data.model.ProcessStepEntity
;
import
org.apache.http.util.TextUtils
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
org.aspectj.lang.ProceedingJoinPoint
;
...
...
@@ -41,6 +43,7 @@ import org.slf4j.MDC;
import
org.springframework.stereotype.Component
;
import
cn.hutool.core.text.StrFormatter
;
import
cn.hutool.core.util.ObjectUtil
;
import
lombok.extern.slf4j.Slf4j
;
@Aspect
...
...
@@ -116,12 +119,13 @@ public class ProcessAspect {
return
result
;
}
private
Object
getProcessId
(
ProceedingJoinPoint
joinPoint
)
{
private
Object
getProcessId
(
ProceedingJoinPoint
joinPoint
)
throws
IllegalAccessException
{
Object
[]
params
=
joinPoint
.
getArgs
();
if
(
params
.
length
==
0
)
{
throw
new
IllegalArgumentException
(
"Must have ProcessId params"
);
}
Object
processIdObj
=
null
;
// Get the method, here you can convert the signature strong to MethodSignature
MethodSignature
signature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
Method
method
=
signature
.
getMethod
();
...
...
@@ -129,13 +133,32 @@ public class ProcessAspect {
Annotation
[][]
annotations
=
method
.
getParameterAnnotations
();
for
(
int
i
=
0
;
i
<
annotations
.
length
;
i
++)
{
Object
param
=
params
[
i
];
if
(
param
==
null
)
continue
;
// Check whether the parameters on the method have the Process Id annotation
Annotation
[]
paramAnn
=
annotations
[
i
];
for
(
Annotation
annotation
:
paramAnn
)
{
if
(
annotation
instanceof
ProcessId
)
{
return
String
.
valueOf
(
param
.
hashCode
());
processIdObj
=
param
;
break
;
}
}
// If there is no Process Id annotation on the parameter,
// continue to find out whether there is a variable in the object with the Process Id annotation
if
(
processIdObj
==
null
)
{
Field
[]
fields
=
param
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
if
(
field
.
isAnnotationPresent
(
ProcessId
.
class
))
{
field
.
setAccessible
(
true
);
processIdObj
=
field
.
get
(
param
);
}
}
}
}
if
(
ObjectUtil
.
isBasicType
(
processIdObj
))
{
return
processIdObj
;
}
else
{
throw
new
DinkyException
(
"The type of the parameter annotated with @ProcessId must be a basic type and not null"
);
}
throw
new
IllegalArgumentException
(
"Must have ProcessId annoation params"
);
}
}
dinky-admin/src/main/java/org/dinky/controller/TaskController.java
View file @
3f9bf1c7
...
...
@@ -95,6 +95,7 @@ public class TaskController {
required
=
true
,
dataType
=
"DebugDTO"
,
paramType
=
"body"
)
@ExecuteProcess
(
type
=
ProcessType
.
FLINK_SUBMIT
)
public
Result
<
JobResult
>
debugTask
(
@RequestBody
DebugDTO
debugDTO
)
throws
Exception
{
JobResult
result
=
taskService
.
debugTask
(
debugDTO
);
if
(
result
.
isSuccess
())
{
...
...
@@ -159,7 +160,7 @@ public class TaskController {
@PostMapping
(
"/getJobPlan"
)
@ApiOperation
(
"Get Job Plan"
)
@ExecuteProcess
(
type
=
ProcessType
.
FLINK_JOB_PLAN
)
public
Result
<
ObjectNode
>
getJobPlan
(
@
ProcessId
@
RequestBody
TaskDTO
taskDTO
)
{
public
Result
<
ObjectNode
>
getJobPlan
(
@RequestBody
TaskDTO
taskDTO
)
{
ObjectNode
jobPlan
=
null
;
jobPlan
=
taskService
.
getJobPlan
(
taskDTO
);
return
Result
.
succeed
(
jobPlan
,
Status
.
EXECUTE_SUCCESS
);
...
...
dinky-admin/src/main/java/org/dinky/data/dto/DebugDTO.java
View file @
3f9bf1c7
...
...
@@ -19,6 +19,8 @@
package
org
.
dinky
.
data
.
dto
;
import
org.dinky.data.annotations.ProcessId
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
...
...
@@ -37,6 +39,7 @@ public class DebugDTO {
dataType
=
"Integer"
,
example
=
"1"
,
notes
=
"The ID of Task which is debugged"
)
@ProcessId
private
Integer
id
;
@ApiModelProperty
(
...
...
dinky-admin/src/main/java/org/dinky/data/dto/TaskDTO.java
View file @
3f9bf1c7
...
...
@@ -19,6 +19,7 @@
package
org
.
dinky
.
data
.
dto
;
import
org.dinky.data.annotations.ProcessId
;
import
org.dinky.data.model.Task
;
import
org.dinky.data.model.ext.TaskExtConfig
;
import
org.dinky.job.JobConfig
;
...
...
@@ -43,6 +44,10 @@ import lombok.extern.slf4j.Slf4j;
@ApiModel
(
value
=
"StudioExecuteDTO"
,
description
=
"DTO for executing SQL queries"
)
public
class
TaskDTO
extends
AbstractStatementDTO
{
@ApiModelProperty
(
value
=
"ID"
,
dataType
=
"Integer"
,
example
=
"6"
,
notes
=
"The identifier of the execution"
)
@ProcessId
private
Integer
id
;
@ApiModelProperty
(
value
=
"Name"
,
required
=
true
,
dataType
=
"String"
,
example
=
"Name"
)
private
String
name
;
...
...
@@ -209,9 +214,6 @@ public class TaskDTO extends AbstractStatementDTO {
@ApiModelProperty
(
value
=
"Job Name"
,
dataType
=
"String"
,
example
=
"MyJob"
,
notes
=
"The name of the job"
)
private
String
jobName
;
@ApiModelProperty
(
value
=
"ID"
,
dataType
=
"Integer"
,
example
=
"6"
,
notes
=
"The identifier of the execution"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"Max Row Number"
,
dataType
=
"Integer"
,
...
...
dinky-common/src/main/java/org/dinky/data/annotations/ProcessId.java
View file @
3f9bf1c7
...
...
@@ -25,7 +25,7 @@ import java.lang.annotation.Retention;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
@Target
(
ElementType
.
PARAMETER
)
@Target
(
{
ElementType
.
PARAMETER
,
ElementType
.
FIELD
}
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Inherited
public
@interface
ProcessId
{}
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