Skip to content

Conditionally download jars only if hashes do not match #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 8, 2025

Conversation

david-zlai
Copy link
Contributor

@david-zlai david-zlai commented Feb 6, 2025

Summary

Tested locally.

Tested when file doesn't exist for the first time (it downloads), and then rerunning and seeing script not download since file hashes are the same.

(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
....
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from bucket zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

Tested when file changes:

(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: NWH0FQ==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from bucket zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

Checklist

  • Added Unit Tests
  • Covered by existing CI
  • Integration tested
  • Documentation update

Summary by CodeRabbit

  • New Features
    • Enhanced the file download process by adding integrity checks, ensuring that files are only downloaded when updates are detected.
  • Chores
    • Streamlined file management by moving downloads to a dedicated, consistent folder, improving overall efficiency.

Copy link

coderabbitai bot commented Feb 6, 2025

Walkthrough

The changes enhance file download functionality by integrating integrity checks. New functions calculate hash values for both remote (GCS) and local files, comparing them before initiating a download. Existing download functions now check if the local file matches the GCS version to avoid redundant downloads. Additionally, the use of a fixed storage location (ZIPLINE_DIRECTORY) replaces the prior temporary directory mechanism.

Changes

File Path Change Summary
api/py/ai/chronon/.../run.py Added functions for computing GCS and local file hashes and comparing them. Modified existing download functions to perform hash checks and use ZIPLINE_DIRECTORY.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Downloader
    participant LocalStore as "Local Storage"
    participant GCS as "Google Cloud Storage"

    Client->>Downloader: Request file download
    Downloader->>LocalStore: Compute local file hash
    Downloader->>GCS: Retrieve remote file hash
    Downloader->>Downloader: Compare hash values
    alt Hashes match
        Downloader->>Client: Notify file up-to-date (skip download)
    else Hashes differ
        Downloader->>GCS: Download updated file
        Downloader->>LocalStore: Save file to ZIPLINE_DIRECTORY
        Downloader->>Client: Confirm download completion
    end
Loading

Possibly related PRs

Suggested reviewers

  • tchow-zlai
  • piyush-zlai
  • nikhil-zlai
  • kumar-zlai

Poem

In bytes we trust, in hashes we sing,
Files verified, no redundant wing.
ZIPLINE holds the treasure tight,
A dance of data, pure and light.
Code flows smooth, day and night.

Warning

Review ran into problems

🔥 Problems

GitHub Actions and Pipeline Checks: Resource not accessible by integration - https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository.

Please grant the required permissions to the CodeRabbit GitHub App under the organization or repository settings.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@david-zlai david-zlai marked this pull request as ready for review February 6, 2025 17:58
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
api/py/ai/chronon/repo/run.py (2)

900-913: Repetitive download code.
Consider consolidating to reduce duplication.


924-938: Similarly duplicated jar download logic.
Extract into a helper function for maintainability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 9cf25f3 and 8fa05be.

📒 Files selected for processing (1)
  • api/py/ai/chronon/repo/run.py (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: non_spark_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (6)
api/py/ai/chronon/repo/run.py (6)

21-21: No concerns with the new import.


23-23: Verify dependency is properly included.
Ensure the environment has google-crc32c installed and pinned if needed.


139-139: Potential ephemeral directory concern.
Using /tmp might risk data loss on system cleanup. Confirm if that’s intended.


875-888: Good logic for conditional download.
Checks local hash vs GCS before downloading. Looks correct.


975-1034: Hashing functions are properly structured.
They accurately compute and compare CRC32C values.


1085-1096: Clear fallback logic for jar selection.
Implementation is straightforward and flexible.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
api/py/ai/chronon/repo/run.py (2)

140-140: Consider using a configurable directory path.

Hard-coding /tmp/zipline might not work in all environments. Consider making it configurable via environment variable.

-ZIPLINE_DIRECTORY = "/tmp/zipline"
+ZIPLINE_DIRECTORY = os.environ.get('ZIPLINE_DIRECTORY', '/tmp/zipline')

868-889: Add return type hint.

Function is missing return type annotation.

-def download_zipline_jar(destination_dir: str, customer_id: str, jar_name: str):
+def download_zipline_jar(destination_dir: str, customer_id: str, jar_name: str) -> str:
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 8fa05be and 4714b21.

📒 Files selected for processing (1)
  • api/py/ai/chronon/repo/run.py (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: non_spark_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (2)
api/py/ai/chronon/repo/run.py (2)

926-984: Well-implemented hash comparison functions!

The implementation is robust with proper error handling, efficient file reading in chunks, and clear documentation.


1035-1044: LGTM! Clean implementation of JAR download logic.

The directory creation and JAR path construction are well-handled.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
api/py/ai/chronon/repo/run.py (2)

868-889: Add retry mechanism and improve path handling.

The function lacks retry capability and uses string concatenation for paths.

+@retry_decorator(retries=2, backoff=5)
 def download_zipline_jar(destination_dir: str, customer_id: str, jar_name: str):
     bucket_name = f"zipline-artifacts-{customer_id}"
-    source_blob_name = f"jars/{jar_name}"
-    destination_path = f"{destination_dir}/{jar_name}"
+    source_blob_name = os.path.join("jars", jar_name)
+    destination_path = os.path.join(destination_dir, jar_name)

1035-1035: Handle directory creation errors.

Add explicit error handling for directory creation.

-    os.makedirs(ZIPLINE_DIRECTORY, exist_ok=True)
+    try:
+        os.makedirs(ZIPLINE_DIRECTORY, exist_ok=True)
+    except PermissionError as e:
+        raise RuntimeError(f"Cannot create directory {ZIPLINE_DIRECTORY}: Permission denied") from e
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 4714b21 and dcc53cd.

📒 Files selected for processing (1)
  • api/py/ai/chronon/repo/run.py (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: non_spark_tests
  • GitHub Check: enforce_triggered_workflows

Comment on lines +961 to +984
def compare_gcs_and_local_file_hashes(bucket_name: str, blob_name: str, local_file_path: str) -> bool:
"""
Compare hashes of a GCS file and a local file to check if they're identical.

Args:
bucket_name: Name of the GCS bucket
blob_name: Name/path of the blob in the bucket
local_file_path: Path to the local file

Returns:
True if files are identical, False otherwise
"""
try:
gcs_hash = get_gcs_file_hash(bucket_name, blob_name)
local_hash = get_local_file_hash(local_file_path)

print(f"Local hash of {local_file_path}: {local_hash}. GCS file {blob_name} hash: {gcs_hash}")

return gcs_hash == local_hash

except Exception as e:
print(f"Error comparing files: {str(e)}")
return False

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve error handling in hash comparison.

The function silently returns False on errors, which could mask issues like permission problems or network errors.

-    except Exception as e:
-        print(f"Error comparing files: {str(e)}")
-        return False
+    except FileNotFoundError as e:
+        print(f"File not found error: {str(e)}")
+        return False
+    except (storage.exceptions.NotFound, storage.exceptions.Forbidden) as e:
+        print(f"GCS error: {str(e)}")
+        return False
+    except Exception as e:
+        print(f"Unexpected error comparing files: {str(e)}")
+        raise
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def compare_gcs_and_local_file_hashes(bucket_name: str, blob_name: str, local_file_path: str) -> bool:
"""
Compare hashes of a GCS file and a local file to check if they're identical.
Args:
bucket_name: Name of the GCS bucket
blob_name: Name/path of the blob in the bucket
local_file_path: Path to the local file
Returns:
True if files are identical, False otherwise
"""
try:
gcs_hash = get_gcs_file_hash(bucket_name, blob_name)
local_hash = get_local_file_hash(local_file_path)
print(f"Local hash of {local_file_path}: {local_hash}. GCS file {blob_name} hash: {gcs_hash}")
return gcs_hash == local_hash
except Exception as e:
print(f"Error comparing files: {str(e)}")
return False
def compare_gcs_and_local_file_hashes(bucket_name: str, blob_name: str, local_file_path: str) -> bool:
"""
Compare hashes of a GCS file and a local file to check if they're identical.
Args:
bucket_name: Name of the GCS bucket
blob_name: Name/path of the blob in the bucket
local_file_path: Path to the local file
Returns:
True if files are identical, False otherwise
"""
try:
gcs_hash = get_gcs_file_hash(bucket_name, blob_name)
local_hash = get_local_file_hash(local_file_path)
print(f"Local hash of {local_file_path}: {local_hash}. GCS file {blob_name} hash: {gcs_hash}")
return gcs_hash == local_hash
except FileNotFoundError as e:
print(f"File not found error: {str(e)}")
return False
except (storage.exceptions.NotFound, storage.exceptions.Forbidden) as e:
print(f"GCS error: {str(e)}")
return False
except Exception as e:
print(f"Unexpected error comparing files: {str(e)}")
raise

@david-zlai david-zlai merged commit c5eed21 into main Feb 8, 2025
6 checks passed
@david-zlai david-zlai deleted the davidhan/conditionally_download_jar branch February 8, 2025 22:25
kumar-zlai pushed a commit that referenced this pull request Apr 25, 2025
## Summary

Tested locally.

Tested when file doesn't exist for the first time (it downloads), and
then rerunning and seeing script not download since file hashes are the
same.
```
(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
....
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from bucket zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

```

Tested when file changes:
```
(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: NWH0FQ==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from bucket zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

```

## Checklist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced the file download process by adding integrity checks,
ensuring that files are only downloaded when updates are detected.
- **Chores**
- Streamlined file management by moving downloads to a dedicated,
consistent folder, improving overall efficiency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
kumar-zlai pushed a commit that referenced this pull request Apr 29, 2025
## Summary

Tested locally.

Tested when file doesn't exist for the first time (it downloads), and
then rerunning and seeing script not download since file hashes are the
same.
```
(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
....
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from bucket zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

```

Tested when file changes:
```
(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: NWH0FQ==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from bucket zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

```

## Checklist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced the file download process by adding integrity checks,
ensuring that files are only downloaded when updates are detected.
- **Chores**
- Streamlined file management by moving downloads to a dedicated,
consistent folder, improving overall efficiency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
chewy-zlai pushed a commit that referenced this pull request May 15, 2025
## Summary

Tested locally.

Tested when file doesn't exist for the first time (it downloads), and
then rerunning and seeing script not download since file hashes are the
same.
```
(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
....
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from bucket zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

```

Tested when file changes:
```
(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: NWH0FQ==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from bucket zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

```

## Checklist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced the file download process by adding integrity checks,
ensuring that files are only downloaded when updates are detected.
- **Chores**
- Streamlined file management by moving downloads to a dedicated,
consistent folder, improving overall efficiency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
chewy-zlai pushed a commit that referenced this pull request May 15, 2025
## Summary

Tested locally.

Tested when file doesn't exist for the first time (it downloads), and
then rerunning and seeing script not download since file hashes are the
same.
```
(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
....
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from bucket zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

```

Tested when file changes:
```
(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: NWH0FQ==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from bucket zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode backfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

```

## Checklist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced the file download process by adding integrity checks,
ensuring that files are only downloaded when updates are detected.
- **Chores**
- Streamlined file management by moving downloads to a dedicated,
consistent folder, improving overall efficiency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
chewy-zlai pushed a commit that referenced this pull request May 16, 2025
## Summary

Tested locally.

Tested when file doesn't exist for the first time (it downloads), and
then rerunning and seeing script not download since file hashes are the
same.
```
(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode baour clientsfill
....
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from buour clientset zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode baour clientsfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

```

Tested when file changes:
```
(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode baour clientsfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: NWH0FQ==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar does NOT match GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar
Downloading dataproc submitter jar from GCS...
Downloaded storage object jars/cloud_gcp_submitter_deploy.jar from buour clientset zipline-artifacts-canary to local file /tmp/zipline/cloud_gcp_submitter_deploy.jar.



(dev_chronon) davidhan@Davids-MacBook-Pro: ~/zipline/chronon/api/py/test/sample (davidhan/conditionally_download_jar) $ python $RUN_PY --mode baour clientsfill
...
Local hash of /tmp/zipline/cloud_gcp_submitter_deploy.jar: 0lEgxw==. GCS file jars/cloud_gcp_submitter_deploy.jar hash: 0lEgxw==
/tmp/zipline/cloud_gcp_submitter_deploy.jar matches GCS zipline-artifacts-canary/jars/cloud_gcp_submitter_deploy.jar

```

## Cheour clientslist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced the file download process by adding integrity cheour clientss,
ensuring that files are only downloaded when updates are detected.
- **Chores**
- Streamlined file management by moving downloads to a dedicated,
consistent folder, improving overall efficiency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants