You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/11/11 13:04:11 UTC

[GitHub] [flink] zentol opened a new pull request, #21300: [FLINK-29423][rest] Remove custom JobDetails serializer

zentol opened a new pull request, #21300:
URL: https://github.com/apache/flink/pull/21300

   Remove custom serializer so we can properly document the `JobDetails` response.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] XComp commented on a diff in pull request #21300: [FLINK-29423][rest] Remove custom JobDetails serializer

Posted by GitBox <gi...@apache.org>.
XComp commented on code in PR #21300:
URL: https://github.com/apache/flink/pull/21300#discussion_r1027615498


##########
flink-runtime/src/main/java/org/apache/flink/runtime/messages/webmonitor/JobDetails.java:
##########
@@ -93,6 +92,29 @@ public class JobDetails implements Serializable {
      */
     private final Map<String, Map<Integer, CurrentAttempts>> currentExecutionAttempts;
 
+    @JsonCreator
+    public JobDetails(
+            @JsonProperty(FIELD_NAME_JOB_ID) @JsonDeserialize(using = JobIDDeserializer.class)
+                    JobID jobId,
+            @JsonProperty(FIELD_NAME_JOB_NAME) String jobName,
+            @JsonProperty(FIELD_NAME_START_TIME) long startTime,
+            @JsonProperty(FIELD_NAME_END_TIME) long endTime,
+            @JsonProperty(FIELD_NAME_DURATION) long duration,
+            @JsonProperty(FIELD_NAME_STATUS) JobStatus status,
+            @JsonProperty(FIELD_NAME_LAST_MODIFICATION) long lastUpdateTime,
+            @JsonProperty(FIELD_NAME_TASKS) Map<String, Integer> taskInfo) {
+        this(
+                jobId,
+                jobName,
+                startTime,
+                endTime,
+                duration,
+                status,
+                lastUpdateTime,
+                extractNumTasksPerState(taskInfo),
+                taskInfo.get(FIELD_NAME_TOTAL_NUMBER_TASKS));
+    }
+
     @VisibleForTesting

Review Comment:
   ```suggestion
   ```
   This is not true anymore since you're using this constructor in the constructor annotated with `@JsonCreator`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #21300: [FLINK-29423][rest] Remove custom JobDetails serializer

Posted by GitBox <gi...@apache.org>.
zentol commented on code in PR #21300:
URL: https://github.com/apache/flink/pull/21300#discussion_r1020203806


##########
docs/layouts/shortcodes/generated/rest_v1_dispatcher.html:
##########
@@ -1084,7 +1084,38 @@
     "jobs" : {
       "type" : "array",
       "items" : {
-        "type" : "any"

Review Comment:
   The non-openapi docs don't further analyze objects if they use a custom serializer, hence why this was basically empty before.



##########
docs/static/generated/rest_v1_dispatcher.yml:
##########
@@ -2210,36 +2198,27 @@ components:
     JobDetails:
       type: object
       properties:
-        currentExecutionAttempts:
-          type: object
-          additionalProperties:
-            type: object
-            additionalProperties:
-              $ref: '#/components/schemas/CurrentAttempts'
         duration:
           type: integer
           format: int64
-        endTime:
+        end-time:

Review Comment:
   These are all just _corrections_.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] flinkbot commented on pull request #21300: [FLINK-29423][rest] Remove custom JobDetails serializer

Posted by GitBox <gi...@apache.org>.
flinkbot commented on PR #21300:
URL: https://github.com/apache/flink/pull/21300#issuecomment-1311678241

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "124b0ca84f6359094558ad9fb51e866bb7170125",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "124b0ca84f6359094558ad9fb51e866bb7170125",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 124b0ca84f6359094558ad9fb51e866bb7170125 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol merged pull request #21300: [FLINK-29423][rest] Remove custom JobDetails serializer

Posted by GitBox <gi...@apache.org>.
zentol merged PR #21300:
URL: https://github.com/apache/flink/pull/21300


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #21300: [FLINK-29423][rest] Remove custom JobDetails serializer

Posted by GitBox <gi...@apache.org>.
zentol commented on code in PR #21300:
URL: https://github.com/apache/flink/pull/21300#discussion_r1027885797


##########
flink-runtime/src/main/java/org/apache/flink/runtime/messages/webmonitor/JobDetails.java:
##########
@@ -93,6 +92,29 @@ public class JobDetails implements Serializable {
      */
     private final Map<String, Map<Integer, CurrentAttempts>> currentExecutionAttempts;
 
+    @JsonCreator
+    public JobDetails(
+            @JsonProperty(FIELD_NAME_JOB_ID) @JsonDeserialize(using = JobIDDeserializer.class)
+                    JobID jobId,
+            @JsonProperty(FIELD_NAME_JOB_NAME) String jobName,
+            @JsonProperty(FIELD_NAME_START_TIME) long startTime,
+            @JsonProperty(FIELD_NAME_END_TIME) long endTime,
+            @JsonProperty(FIELD_NAME_DURATION) long duration,
+            @JsonProperty(FIELD_NAME_STATUS) JobStatus status,
+            @JsonProperty(FIELD_NAME_LAST_MODIFICATION) long lastUpdateTime,
+            @JsonProperty(FIELD_NAME_TASKS) Map<String, Integer> taskInfo) {
+        this(
+                jobId,
+                jobName,
+                startTime,
+                endTime,
+                duration,
+                status,
+                lastUpdateTime,
+                extractNumTasksPerState(taskInfo),
+                taskInfo.get(FIELD_NAME_TOTAL_NUMBER_TASKS));
+    }
+
     @VisibleForTesting

Review Comment:
   Does that matter for visibility? if the test wouldn't exist it'd be private; the JsonCreator constructor doesn't change that?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #21300: [FLINK-29423][rest] Remove custom JobDetails serializer

Posted by GitBox <gi...@apache.org>.
zentol commented on code in PR #21300:
URL: https://github.com/apache/flink/pull/21300#discussion_r1020202889


##########
docs/layouts/shortcodes/generated/rest_v1_dispatcher.html:
##########
@@ -1084,7 +1084,38 @@
     "jobs" : {
       "type" : "array",
       "items" : {
-        "type" : "any"
+        "type" : "object",
+        "id" : "urn:jsonschema:org:apache:flink:runtime:messages:webmonitor:JobDetails",
+        "properties" : {
+          "duration" : {
+            "type" : "integer"
+          },
+          "end-time" : {
+            "type" : "integer"
+          },
+          "jid" : {
+            "type" : "any"
+          },
+          "last-modification" : {
+            "type" : "integer"
+          },
+          "name" : {
+            "type" : "string"
+          },
+          "start-time" : {
+            "type" : "integer"
+          },
+          "state" : {
+            "type" : "string",
+            "enum" : [ "INITIALIZING", "CREATED", "RUNNING", "FAILING", "FAILED", "CANCELLING", "CANCELED", "FINISHED", "RESTARTING", "SUSPENDED", "RECONCILING" ]
+          },
+          "tasks" : {
+            "type" : "object",
+            "additionalProperties" : {
+              "type" : "integer"
+            }
+          }

Review Comment:
   This is a bit of a short-cut, but the alternative would be hard-code a class with a field for each execution state (+ 1 additional field to the total count.
   This is how the field looks like in practice:
   ```
   {
   "total":3,
   "created":0,
   "scheduled":0,
   "deploying":0,
   "running":0,
   "finished":3,
   "canceling":0,
   "canceled":0,
   "failed":0,
   "reconciling":0,
   "initializing":0
   }
   ```



##########
docs/static/generated/rest_v1_dispatcher.yml:
##########
@@ -1886,18 +1886,6 @@ components:
         total:
           type: integer
           format: int64
-    CurrentAttempts:

Review Comment:
   This never should've been documented.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] XComp commented on a diff in pull request #21300: [FLINK-29423][rest] Remove custom JobDetails serializer

Posted by GitBox <gi...@apache.org>.
XComp commented on code in PR #21300:
URL: https://github.com/apache/flink/pull/21300#discussion_r1028642489


##########
flink-runtime/src/main/java/org/apache/flink/runtime/messages/webmonitor/JobDetails.java:
##########
@@ -93,6 +92,29 @@ public class JobDetails implements Serializable {
      */
     private final Map<String, Map<Integer, CurrentAttempts>> currentExecutionAttempts;
 
+    @JsonCreator
+    public JobDetails(
+            @JsonProperty(FIELD_NAME_JOB_ID) @JsonDeserialize(using = JobIDDeserializer.class)
+                    JobID jobId,
+            @JsonProperty(FIELD_NAME_JOB_NAME) String jobName,
+            @JsonProperty(FIELD_NAME_START_TIME) long startTime,
+            @JsonProperty(FIELD_NAME_END_TIME) long endTime,
+            @JsonProperty(FIELD_NAME_DURATION) long duration,
+            @JsonProperty(FIELD_NAME_STATUS) JobStatus status,
+            @JsonProperty(FIELD_NAME_LAST_MODIFICATION) long lastUpdateTime,
+            @JsonProperty(FIELD_NAME_TASKS) Map<String, Integer> taskInfo) {
+        this(
+                jobId,
+                jobName,
+                startTime,
+                endTime,
+                duration,
+                status,
+                lastUpdateTime,
+                extractNumTasksPerState(taskInfo),
+                taskInfo.get(FIELD_NAME_TOTAL_NUMBER_TASKS));
+    }
+
     @VisibleForTesting

Review Comment:
   actual, you're right. I didn't think this through. :+1: 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #21300: [FLINK-29423][rest] Remove custom JobDetails serializer

Posted by GitBox <gi...@apache.org>.
zentol commented on code in PR #21300:
URL: https://github.com/apache/flink/pull/21300#discussion_r1027885797


##########
flink-runtime/src/main/java/org/apache/flink/runtime/messages/webmonitor/JobDetails.java:
##########
@@ -93,6 +92,29 @@ public class JobDetails implements Serializable {
      */
     private final Map<String, Map<Integer, CurrentAttempts>> currentExecutionAttempts;
 
+    @JsonCreator
+    public JobDetails(
+            @JsonProperty(FIELD_NAME_JOB_ID) @JsonDeserialize(using = JobIDDeserializer.class)
+                    JobID jobId,
+            @JsonProperty(FIELD_NAME_JOB_NAME) String jobName,
+            @JsonProperty(FIELD_NAME_START_TIME) long startTime,
+            @JsonProperty(FIELD_NAME_END_TIME) long endTime,
+            @JsonProperty(FIELD_NAME_DURATION) long duration,
+            @JsonProperty(FIELD_NAME_STATUS) JobStatus status,
+            @JsonProperty(FIELD_NAME_LAST_MODIFICATION) long lastUpdateTime,
+            @JsonProperty(FIELD_NAME_TASKS) Map<String, Integer> taskInfo) {
+        this(
+                jobId,
+                jobName,
+                startTime,
+                endTime,
+                duration,
+                status,
+                lastUpdateTime,
+                extractNumTasksPerState(taskInfo),
+                taskInfo.get(FIELD_NAME_TOTAL_NUMBER_TASKS));
+    }
+
     @VisibleForTesting

Review Comment:
   Does that matter for visibility? if the test wouldn't exist it'd be (package-?)private; the JsonCreator constructor doesn't change that?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org