You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/07/20 08:58:27 UTC

[GitHub] [pulsar] jiangpengcheng opened a new pull request, #16697: [fix][function] Fix python instance not process zip file correctly

jiangpengcheng opened a new pull request, #16697:
URL: https://github.com/apache/pulsar/pull/16697

   <!--
   ### Contribution Checklist
     
     - PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://docs.google.com/document/d/1d8Pw6ZbWk-_pCKdOmdvx9rnhPiyuxwq60_TrD68d7BA/edit#heading=h.trs9rsex3xom)*. 
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   Fixes #16696 
   
   ### Motivation
   
   
   Make python instance main process zip file correctly when using relative path
   
   ### Modifications
   
   Fix relative path error in `python_instance_main.py`
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   ### Documentation
   
   Check the box below or label this PR directly.
   
   Need to update docs? 
   
   - [x] `doc-not-needed` 
   bug fix
     


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1200771277

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1191467332

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1190934819

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1192052653

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on a diff in pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on code in PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#discussion_r925357042


##########
pulsar-functions/instance/src/main/python/python_instance_main.py:
##########
@@ -123,21 +123,21 @@ def main():
     # run pip install to target folder  deps folder
     zpfile = zipfile.ZipFile(str(args.py), 'r')
     zpfile.extractall(os.path.dirname(str(args.py)))
-    basename = os.path.splitext(str(args.py))[0]
+    basename = os.path.basename(os.path.splitext(str(args.py))[0])

Review Comment:
   if using original code, when specify `--py` with relative path like `py/exclamation.zip`, the `deps_dir` will become `py/py/exclamation/deps` while the correct one is `py/exclamation/deps`



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on a diff in pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on code in PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#discussion_r925357042


##########
pulsar-functions/instance/src/main/python/python_instance_main.py:
##########
@@ -123,21 +123,21 @@ def main():
     # run pip install to target folder  deps folder
     zpfile = zipfile.ZipFile(str(args.py), 'r')
     zpfile.extractall(os.path.dirname(str(args.py)))
-    basename = os.path.splitext(str(args.py))[0]
+    basename = os.path.basename(os.path.splitext(str(args.py))[0])

Review Comment:
   when specify `--py` with relative path like `py/exclamation.zip`, the `deps_dir` will become `py/py/exclamation/deps` while the correct one is `py/exclamation/deps`



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on a diff in pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on code in PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#discussion_r925359070


##########
pulsar-functions/instance/src/main/python/python_instance_main.py:
##########
@@ -123,21 +123,21 @@ def main():
     # run pip install to target folder  deps folder
     zpfile = zipfile.ZipFile(str(args.py), 'r')
     zpfile.extractall(os.path.dirname(str(args.py)))
-    basename = os.path.splitext(str(args.py))[0]
+    basename = os.path.basename(os.path.splitext(str(args.py))[0])
 
     deps_dir = os.path.join(os.path.dirname(str(args.py)), basename, "deps")
 
     if os.path.isdir(deps_dir) and os.listdir(deps_dir):
       # get all wheel files from deps directory
       wheel_file_list = [os.path.join(deps_dir, f) for f in os.listdir(deps_dir) if os.path.isfile(os.path.join(deps_dir, f)) and os.path.splitext(f)[1] =='.whl']
-      cmd = "pip install -t %s --no-index --find-links %s %s" % (os.path.dirname(str(args.py)), deps_dir, " ".join(wheel_file_list))
+      cmd = "pip install -t %s --no-index --find-links %s %s" % (os.path.dirname(os.path.abspath(str(args.py))), deps_dir, " ".join(wheel_file_list))

Review Comment:
   `os.path.dirname(str(args.py))` can be an empty value which will make the pip install deps to the `--no-index` directory



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1191184357

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1200884498

   /pulsarbot run Unit-BROKER_FLAKY Tests


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Technoboy- merged pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
Technoboy- merged PR #16697:
URL: https://github.com/apache/pulsar/pull/16697


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1200825712

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1193586607

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1200744062

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1191120766

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1192275986

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] jiangpengcheng commented on pull request #16697: [fix][function] Fix python instance not process zip file correctly

Posted by GitBox <gi...@apache.org>.
jiangpengcheng commented on PR #16697:
URL: https://github.com/apache/pulsar/pull/16697#issuecomment-1191078603

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org