Skip to content
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

📖 xai lib utils zip component #120

Merged
merged 4 commits into from
Mar 8, 2022

Conversation

MFA-X-AI
Copy link
Member

@MFA-X-AI MFA-X-AI commented Mar 8, 2022

Description

During Spark Submit in cluster mode, users would need to bundle their python packages and xai_component library. This PR provides the ZipDirectory component which can do it in python.

image

It is smart enough to create a new zip if zip_fn doesn't exist (if not provided, will use xircuits_name as fn), and add it to the zip if fn already exists. It is also has the option to include / exclude the root dir.

For example if you'd like to zip your venv site packages you could zip it like:

venv.zip
└── site-packages
    └── lib1
    └── lib2

or you can zip it excluding site-packages:

venv.zip
    └── lib1
    └── lib2

I've also added a xircuits in the examples folder (since people would need to do it before spark submitting anyways) and for you to try.

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Tests

You can either start from a new .xircuits or use UtilsZipDirectory.xircuits

image

  1. Check Create - Add Zip File
    1. Chain 2 ZipDirectory components
    2. Either provide them the same zip_fn string or leave it blank. Run it.
    3. The first component should create the zip, while the 2nd should update it.
Executing: ZipDirectory
UtilsZipDirectory.zip created at /your/path/
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 17/17 [00:00<00:00, 680.03it/s]

Executing: ZipDirectory
UtilsZipDirectory.zip updated at /your/path/
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 111.10it/s]
  1. Check Exclude - Include Root Dir

    1. Chain 2 ZipDirectory components
    2. Either provide them the same zip_fn string or leave it blank.
    3. Set include_dir as False. Run it.
    4. If you ran UtilsZipDirectory.xircuits, the output should be:

include_dir = True:

venv.zip
    └── examples
        └── xircuits example 1
        └── xircuits example ...
    
    └── xai_components
        └── xai_lib 1
        └── xai_lib ...

include_dir = False:

venv.zip
        └── xircuits example 1
        └── xircuits example ...
        └── xai_lib 1
        └── xai_lib ...

Tested on?

  • Windows
  • Linux Ubuntu
  • Centos
  • Mac
  • Others (State here -> xxx )

Notes

The component uses tqdm + os.walk which I've read that it might consume unlimited RAM if there's a circular symlink path... but that's unlikely to happen right?

@MFA-X-AI MFA-X-AI requested a review from AdrySky March 8, 2022 04:35
Copy link
Contributor

@AdrySky AdrySky left a comment

Choose a reason for hiding this comment

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

LGTM.

The component uses tqdm + os.walk which I've read that it might consume unlimited RAM if there's a circular symlink path... but that's unlikely to happen right?

Though, not sure about this. I think we'll deal with it when it does goes wrong.

@AdrySky AdrySky merged commit 34a25c5 into master Mar 8, 2022
@AdrySky AdrySky deleted the fahreza/xai-lib-utils-zip-component branch March 8, 2022 06:56
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