codeant-ai-for-open-source[bot] commented on code in PR #43916:
URL: https://github.com/apache/superset/pull/43916#discussion_r3939099086


##########
docker/docker-init.sh:
##########
@@ -70,12 +70,28 @@ if [ "$SUPERSET_LOAD_EXAMPLES" = "yes" ]; then
     # Load some data to play with
     echo_step "4" "Starting" "Loading examples"
 
+    EXAMPLES_LOADED_MARKER="${SUPERSET_HOME}/.examples-loaded"
 
-    # If Cypress run which consumes superset_test_config โ€“ load required data 
for tests
-    if [ "$CYPRESS_CONFIG" == "true" ]; then
-        superset load_examples --load-test-data
+    # Loading examples parses and inserts every example dataset/dashboard/chart
+    # and is one of the slowest steps of `docker compose up`. Once it has
+    # succeeded, subsequent `docker-init.sh` runs against the same
+    # superset_home volume only need to refresh metadata (e.g. after a
+    # `superset db upgrade`), not reload the data itself. Set
+    # SUPERSET_FORCE_LOAD_EXAMPLES=yes to force a full reload regardless.
+    # Cypress runs always do a full reload since they load a distinct set of
+    # test data (`--load-test-data`) into a separate `superset_cypress`
+    # database that the metadata-only marker doesn't track.
+    if [ -f "$EXAMPLES_LOADED_MARKER" ] && [ "$SUPERSET_FORCE_LOAD_EXAMPLES" 
!= "yes" ] && [ "$CYPRESS_CONFIG" != "true" ]; then

Review Comment:
   **Suggestion:** When the database volume is recreated but `superset_home` 
remains, this marker selects metadata-only loading and leaves the database 
without example data. [possible bug]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f5723ccade554b7c81700733b02d778d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f5723ccade554b7c81700733b02d778d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** docker/docker-init.sh
   **Line:** 84:84
   **Comment:**
        *Possible Bug: When the database volume is recreated but 
`superset_home` remains, this marker selects metadata-only loading and leaves 
the database without example data.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43916&comment_hash=7fff8926a4f17ac6d03bf87447ddaf5acd537ce82b96c91ea0f5136cb05a18ae&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43916&comment_hash=7fff8926a4f17ac6d03bf87447ddaf5acd537ce82b96c91ea0f5136cb05a18ae&reaction=dislike'>๐Ÿ‘Ž</a>



##########
docker/docker-init.sh:
##########
@@ -70,12 +70,28 @@ if [ "$SUPERSET_LOAD_EXAMPLES" = "yes" ]; then
     # Load some data to play with
     echo_step "4" "Starting" "Loading examples"
 
+    EXAMPLES_LOADED_MARKER="${SUPERSET_HOME}/.examples-loaded"
 
-    # If Cypress run which consumes superset_test_config โ€“ load required data 
for tests
-    if [ "$CYPRESS_CONFIG" == "true" ]; then
-        superset load_examples --load-test-data
+    # Loading examples parses and inserts every example dataset/dashboard/chart
+    # and is one of the slowest steps of `docker compose up`. Once it has
+    # succeeded, subsequent `docker-init.sh` runs against the same
+    # superset_home volume only need to refresh metadata (e.g. after a
+    # `superset db upgrade`), not reload the data itself. Set
+    # SUPERSET_FORCE_LOAD_EXAMPLES=yes to force a full reload regardless.
+    # Cypress runs always do a full reload since they load a distinct set of
+    # test data (`--load-test-data`) into a separate `superset_cypress`
+    # database that the metadata-only marker doesn't track.
+    if [ -f "$EXAMPLES_LOADED_MARKER" ] && [ "$SUPERSET_FORCE_LOAD_EXAMPLES" 
!= "yes" ] && [ "$CYPRESS_CONFIG" != "true" ]; then
+        echo "Examples already loaded, refreshing metadata only (set 
SUPERSET_FORCE_LOAD_EXAMPLES=yes to force a full reload)"
+        superset load_examples --only-metadata
     else
-        superset load_examples
+        # If Cypress run which consumes superset_test_config โ€“ load required 
data for tests
+        if [ "$CYPRESS_CONFIG" == "true" ]; then
+            superset load_examples --load-test-data
+        else
+            superset load_examples
+        fi
+        touch "$EXAMPLES_LOADED_MARKER"

Review Comment:
   **Suggestion:** The marker is created after a successful command even when 
individual dataset loaders only log failures, so later starts stop retrying 
those failed loads. [logic error]
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=09204ae121064941bb4ad9db81a1a8e0&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=09204ae121064941bb4ad9db81a1a8e0&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** docker/docker-init.sh
   **Line:** 94:94
   **Comment:**
        *Logic Error: The marker is created after a successful command even 
when individual dataset loaders only log failures, so later starts stop 
retrying those failed loads.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43916&comment_hash=10f780f18a2f97658058742e091f112d5b9c14e8e6c564b42a202b73d41a6d75&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43916&comment_hash=10f780f18a2f97658058742e091f112d5b9c14e8e6c564b42a202b73d41a6d75&reaction=dislike'>๐Ÿ‘Ž</a>



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to