Skip to content

vine: include functions and classes in hoisting_modules #3903

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 1 commit into from
Aug 7, 2024
Merged

vine: include functions and classes in hoisting_modules #3903

merged 1 commit into from
Aug 7, 2024

Conversation

JinZhou5042
Copy link
Member

@JinZhou5042 JinZhou5042 commented Aug 7, 2024

Proposed Changes

This PR is in part to support #3892 to run on a serverless mode. It essentially does two things:

  1. Rename the import_modules to hoisting_modules to expand it's definition, so as to accept not only python packages, but also classes and functions

  2. Accept class and function declarations and hoist in the library code. For example:

import uuid
import random

class test_class():
    def __init__(self):
        print("test")

def test_func():
    return 100

libtask = engine.executor.create_library_from_functions(
    "test-library", noop_task, hoisting_modules=[uuid, random, test_class, test_func], add_env=False
)

This will hoist the declarations of test_class and test_func so that function calls can invoke directly.

Merge Checklist

The following items must be completed before PRs can be merge.
Check these off to verify you have completed all steps.

  • make test Run local tests prior to pushing.
  • make format Format source code to comply with lint policies. Note that some lint errors can only be resolved manually (e.g., Python)
  • make lint Run lint on source code prior to pushing.
  • Manual Update Update the manual to reflect user-visible changes.
  • Type Labels Select a github label for the type: bugfix, enhancement, etc.
  • Product Labels Select a github label for the product: TaskVine, Makeflow, etc.
  • PR RTM Mark your PR as ready to merge.

@JinZhou5042
Copy link
Member Author

RTM

@dthain dthain merged commit 35b3411 into cooperative-computing-lab:master Aug 7, 2024
8 checks passed
@JinZhou5042 JinZhou5042 deleted the include_functions_and_classes_in_import_modules branch August 7, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants