This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7d62cbb97e detailed docs (#30729)
7d62cbb97e is described below

commit 7d62cbb97e1bc225f09e3cfac440aa422087a8a7
Author: Bowrna <[email protected]>
AuthorDate: Sun Apr 23 02:19:40 2023 +0530

    detailed docs (#30729)
---
 airflow/api_connexion/openapi/v1.yaml        | 29 +++++++++++++-
 airflow/www/static/js/types/api-generated.ts | 60 +++++++++++++++++++++++++++-
 2 files changed, 86 insertions(+), 3 deletions(-)

diff --git a/airflow/api_connexion/openapi/v1.yaml 
b/airflow/api_connexion/openapi/v1.yaml
index b75724c002..bcd96442dd 100644
--- a/airflow/api_connexion/openapi/v1.yaml
+++ b/airflow/api_connexion/openapi/v1.yaml
@@ -1668,7 +1668,34 @@ paths:
 
     get:
       summary: Get logs
-      description: Get logs for a specific task instance and its try number.
+      description: |
+        Get logs for a specific task instance and its try number.
+        To get log from specific character position, following way of using
+        URLSafeSerializer can be used.
+
+        Example:
+        ```
+        from itsdangerous.url_safe import URLSafeSerializer
+
+        request_url = 
f"api/v1/dags/{DAG_ID}/dagRuns/{RUN_ID}/taskInstances/{TASK_ID}/logs/1"
+        key = app.config["SECRET_KEY"]
+        serializer = URLSafeSerializer(key)
+        token = serializer.dumps({"log_pos": 10000})
+
+        response = self.client.get(
+            request_url,
+            query_string={"token": token},
+            headers={"Accept": "text/plain"},
+            environ_overrides={"REMOTE_USER": "test"},
+        )
+        continuation_token = response.json["continuation_token"]
+            metadata = URLSafeSerializer(key).loads(continuation_token)
+            log_pos = metadata["log_pos"]
+            end_of_log = metadata["end_of_log"]
+        ```
+        If log_pos is passed as 10000 like the above example, it renders the 
logs starting
+        from char position 10000 to last (not the end as the logs may be 
tailing behind in
+        running state). This way pagination can be done with metadata as part 
of the token.
       x-openapi-router-controller: airflow.api_connexion.endpoints.log_endpoint
       operationId: get_log
       tags: [TaskInstance]
diff --git a/airflow/www/static/js/types/api-generated.ts 
b/airflow/www/static/js/types/api-generated.ts
index 5595b26b18..df89725669 100644
--- a/airflow/www/static/js/types/api-generated.ts
+++ b/airflow/www/static/js/types/api-generated.ts
@@ -483,7 +483,35 @@ export interface paths {
     };
   };
   
"/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/logs/{task_try_number}":
 {
-    /** Get logs for a specific task instance and its try number. */
+    /**
+     * Get logs for a specific task instance and its try number.
+     * To get log from specific character position, following way of using
+     * URLSafeSerializer can be used.
+     *
+     * Example:
+     * ```
+     * from itsdangerous.url_safe import URLSafeSerializer
+     *
+     * request_url = 
f"api/v1/dags/{DAG_ID}/dagRuns/{RUN_ID}/taskInstances/{TASK_ID}/logs/1"
+     * key = app.config["SECRET_KEY"]
+     * serializer = URLSafeSerializer(key)
+     * token = serializer.dumps({"log_pos": 10000})
+     *
+     * response = self.client.get(
+     *     request_url,
+     *     query_string={"token": token},
+     *     headers={"Accept": "text/plain"},
+     *     environ_overrides={"REMOTE_USER": "test"},
+     * )
+     * continuation_token = response.json["continuation_token"]
+     *     metadata = URLSafeSerializer(key).loads(continuation_token)
+     *     log_pos = metadata["log_pos"]
+     *     end_of_log = metadata["end_of_log"]
+     * ```
+     * If log_pos is passed as 10000 like the above example, it renders the 
logs starting
+     * from char position 10000 to last (not the end as the logs may be 
tailing behind in
+     * running state). This way pagination can be done with metadata as part 
of the token.
+     */
     get: operations["get_log"];
     parameters: {
       path: {
@@ -3858,7 +3886,35 @@ export interface operations {
       404: components["responses"]["NotFound"];
     };
   };
-  /** Get logs for a specific task instance and its try number. */
+  /**
+   * Get logs for a specific task instance and its try number.
+   * To get log from specific character position, following way of using
+   * URLSafeSerializer can be used.
+   *
+   * Example:
+   * ```
+   * from itsdangerous.url_safe import URLSafeSerializer
+   *
+   * request_url = 
f"api/v1/dags/{DAG_ID}/dagRuns/{RUN_ID}/taskInstances/{TASK_ID}/logs/1"
+   * key = app.config["SECRET_KEY"]
+   * serializer = URLSafeSerializer(key)
+   * token = serializer.dumps({"log_pos": 10000})
+   *
+   * response = self.client.get(
+   *     request_url,
+   *     query_string={"token": token},
+   *     headers={"Accept": "text/plain"},
+   *     environ_overrides={"REMOTE_USER": "test"},
+   * )
+   * continuation_token = response.json["continuation_token"]
+   *     metadata = URLSafeSerializer(key).loads(continuation_token)
+   *     log_pos = metadata["log_pos"]
+   *     end_of_log = metadata["end_of_log"]
+   * ```
+   * If log_pos is passed as 10000 like the above example, it renders the logs 
starting
+   * from char position 10000 to last (not the end as the logs may be tailing 
behind in
+   * running state). This way pagination can be done with metadata as part of 
the token.
+   */
   get_log: {
     parameters: {
       path: {

Reply via email to