-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Namespacing doesn't work when using Popen in a runned pm2 #4778
Comments
@sbleon Hey there! Has the bug been fixed? :) |
Hi, Barry. I submitted a pull request with a change that I think will fix your issue. It hasn't been merged yet, though, so if you want to try out the bug fix now I suggest that you fork my fork and use your copy of my |
Hi @sbleon After testing your branch it seems like it is still given wrong namespace afterall. What I did is that I started a script called test.py (namespace = hello) which I started with pm2. Inside the test.py I call:
What should happend is that namespace here should have the name test but instead its using the namespace hello from previous test.py. I expected when I give a namespace in Popen then it should use that namespace which in my example is "test" but instead it used from the previous script which has the namespace "hello". Example:
Excepted result: |
Hi, Barry. I think that for the purposes of posting bug reports in pm2, you
should just include pm2 commands, taking your Python wrapper out of the
equation. I don't actually think the original namespace problem you were
experiencing has anything to do with Python.
From a quick search, it looks to me like `Aborted (core dumped)` is a C/CPP
error. I don't think that could come from pm2, unless it has native
extensions that I'm not aware of.
What should happend is that namespace here should have the name test but
instead its using the namespace hello from previous test.py.
I think that namespaces maybe only get detected when first starting a
process. If you want to change the namespace, you may have to `delete` and
then `start` the process anew.
…On Fri, Jul 24, 2020 at 5:34 AM BarryThrill ***@***.***> wrote:
@sbleon <https://github.com/sbleon> Hi again! I have now tested to work
out with your branch and it seems like I do get an error without any
further information but just "*Aborted (core dumped)*" - The reports
doesn't say much either. That it just online.
I tried to run a script that is already ran in a pm2 task with calling Popen("pm2
start /home/test/git/test/WF/Monitoring.py --name test_591 --namespace test
--interpreter=python3 --no-autorestart") which returns Aborted (core
dumped)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4778 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABQQN4MGO43CSWAEDIEIETR5FISVANCNFSM4OXZQJPA>
.
|
Hi there again MR.@sbleon! I have re-edit my question and I agree with what you say! However I do still think it is a bug with the namespaces because what I basically do is that I start a pm2 script that calls another script with pm2 As you mentioned. I do believe it takes the namespace from the first starting process. For me it would be much more needed if I would be able to have the namespace that I have given when starting another pm2 process inside a pm2 process that is already running. To easier navigate my scripts. If that makes sense? |
I agree that the namespace behavior still isn't ideal, even with my patch.
My patch only addresses the first start of a given process. I think that
subsequent starts with a different namespace should spawn new processes. Do
you agree with that?
…On Fri, Jul 24, 2020 at 11:24 AM BarryThrill ***@***.***> wrote:
instead its using the namespace hello from previous test.py. I think that
namespaces maybe only get detected when first starting a process. If you
want to change the namespace, you may have to delete and then start the
process anew.
Hi there again ***@***.*** <https://github.com/sbleon>! I have re-edit my
question and I agree with what you say!
However I do still think it is a bug with the namespaces because what I
basically do is that I start a pm2 script that calls another script with
pm2 pm2 start /home/test/git/test/AIO_WF/junkyard.py --name junkyard_585
--namespace junkyard --interpreter=python3 --no-autorestart which
logically should just create a new PM2 process with the given namespace.
But instead it is just ignoring the namespace for the second script which I
don't see the reason why it wouldn't in this case :(
As you mentioned. I do believe it takes the namespace from the first
starting process. For me it would be much more needed if I would be able to
have the namespace that I have given when starting another pm2 process
inside a pm2 process that is already running. To easier navigate my
scripts. If that makes sense?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4778 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABQQN5QFBPI6RG2WWJGED3R5GRUNANCNFSM4OXZQJPA>
.
|
I would say yes. As it is a new pm2 process with a new namespace and new name it should spawn a new process of that instance. As you mentioned. Your patch only addresses the first start of given process. It should start instead of a new process with given namespace. 😁 |
published in pm2@4.5.0 npm install pm2@latest -g |
Awesome! Thanks for the merge and release!
…On Tue, Sep 29, 2020 at 10:26 AM Alexandre Strzelewicz < ***@***.***> wrote:
published in ***@***.***
npm install ***@***.*** -g
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4778 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABQQN7ZTGZ6SYKS6WWSGJLSIHVCLANCNFSM4OXZQJPA>
.
|
Thanks for the contributions! |
The issue still remains randomly, where it randomly uses the default even thought I have in a script given a namespace like I have given in the start of the thread. |
This issue still exists in version 5.2.2 |
This issue still exists in version 5.3.0 |
What's going wrong?
Hello guys!
I have worked abit with name spacing and I have realized that if you try to do a namespacing inside a script that is runned by pm2 and Popen etc:
Popen(f"pm2 start test.py --name test1 --namespace testing --interpreter=python3", shell=True).communicate()
That will not create a namespace for the name testing.
How could we reproduce this issue?
test_new.py - Run this FIRST with pm2 start test_new.py --interpreter=python3
test.py
print("hello world!")
What should happend is that test.py should have the name = test and namespace = testing but it says default instead.
Excepted result:
Supporting information
I love you guys for what you guys have done <3
The text was updated successfully, but these errors were encountered: