Skip to content

Commit

Permalink
doc: Added comments inside dump_module function
Browse files Browse the repository at this point in the history
  • Loading branch information
hazargurbuzz committed Oct 23, 2024
1 parent 6518782 commit 0742eb1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion upsonic/remote/on_prem.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,11 +566,13 @@ def dump_module(
module_name:str,
module,
) -> None:
# Getting Started and Encryption Preparation
encryption_key = "u"
top_module = module

cloudpickle.register_pickle_by_value(top_module)


# Collection of Sub-Modules
sub_modules = []
if hasattr(top_module, "__path__"):
for importer, modname, ispkg in pkgutil.walk_packages(
Expand All @@ -582,6 +584,7 @@ def dump_module(
else:
sub_modules.append(top_module)

# Collecting object in Submodules
threads = []

the_list = []
Expand All @@ -595,6 +598,7 @@ def dump_module(

the_list = [i for i in the_list if i.__module__.split(".")[0] == module_name]

# Filtering Unwanted Objects
my_list = []
for element in copy.copy(the_list):
if inspect.isfunction(element):
Expand All @@ -610,6 +614,8 @@ def dump_module(
my_list.append(element)

the_list = my_list

# Processing Objects with Multiple Threads
for element in the_list:
time.sleep(0.1)
if inspect.isfunction(element):
Expand Down Expand Up @@ -648,6 +654,7 @@ def dump_module(
self._log(f"[bold red]Error on '{name}'")
self.delete(name)

# Waiting for All Threads to Complate
for each in threads:
each.join()

Expand Down

0 comments on commit 0742eb1

Please sign in to comment.