Jenkins won't execute python subprocess

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Jenkins won't execute python subprocess

TheJonesin__9

I've seen a few suggestions to get around this issue but none of them work for me.


I have Jenkins installed locally on my laptop running Windows10. I've narrowed it down and it is indeed the line in my python script that's calling subprocess.run method. The Python scripts executes up to that point so I'm know the script is getting called from the Jenkins job.


It seems to be a permissions error as suggested in other posts. However, I'm not sure exactly what else I can do. I log into Windows as Admin so that's not the issue.


The Jenkins job is running as the Jenkins Admin user so I'm not sure what else I can do?

Console output:

17:39:21 Started by user admin
17:39:21 Building in workspace C:\Program Files (x86)\Jenkins\workspace\loadrunner_test
17:39:21 [loadrunner_test] $ cmd /c call C:\WINDOWS\TEMP\jenkins2453008242502676618.bat
17:39:21 
17:39:21 C:\Program Files (x86)\Jenkins\workspace\loadrunner_test>cmd /C C:\Python365\python.exe C:\PythonProjects\cicd_loadrunner\cicd_loadrunner.py 
17:44:42 Error:  <class 'subprocess.TimeoutExpired'>
17:44:42 
17:44:42 C:\Program Files (x86)\Jenkins\workspace\loadrunner_test>exit -1 
17:44:42 Build step 'Execute Windows batch command' marked build as failure
17:44:42 Finished: FAILURE


When it tries to execute the subprocess.run method, it just hangs and then eventually times out.


When I run the script manually using windows command prompt, it works as expected.


I've set the Jenkins process to log in using 'allow service to interact with desktop'.


There was once a suggestion saying to move the *.boto file into the Jenkins root but I can't see a *.boto file (Windows install).


Cheers

J

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5c8a78be-88f9-4e6e-83bf-ad5d26d760c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkins won't execute python subprocess

TheJonesin__9
Got there in the end. I had to create a new Windows user which I called JenkinsUser with local admin permissions. I then went into the Jenkins.exe service and am running Jenkins using my new user JenkinsUser.



On Tuesday, July 10, 2018 at 1:11:32 PM UTC+1, TheJonesin__9 wrote:

I've seen a few suggestions to get around this issue but none of them work for me.


I have Jenkins installed locally on my laptop running Windows10. I've narrowed it down and it is indeed the line in my python script that's calling subprocess.run method. The Python scripts executes up to that point so I'm know the script is getting called from the Jenkins job.


It seems to be a permissions error as suggested in other posts. However, I'm not sure exactly what else I can do. I log into Windows as Admin so that's not the issue.


The Jenkins job is running as the Jenkins Admin user so I'm not sure what else I can do?

Console output:

17:39:21 Started by user admin
17:39:21 Building in workspace C:\Program Files (x86)\Jenkins\workspace\loadrunner_test
17:39:21 [loadrunner_test] $ cmd /c call C:\WINDOWS\TEMP\jenkins2453008242502676618.bat
17:39:21 
17:39:21 C:\Program Files (x86)\Jenkins\workspace\loadrunner_test>cmd /C C:\Python365\python.exe C:\PythonProjects\cicd_loadrunner\cicd_loadrunner.py 
17:44:42 Error:  <class 'subprocess.TimeoutExpired'>
17:44:42 
17:44:42 C:\Program Files (x86)\Jenkins\workspace\loadrunner_test>exit -1 
17:44:42 Build step 'Execute Windows batch command' marked build as failure
17:44:42 Finished: FAILURE


When it tries to execute the subprocess.run method, it just hangs and then eventually times out.


When I run the script manually using windows command prompt, it works as expected.


I've set the Jenkins process to log in using 'allow service to interact with desktop'.


There was once a suggestion saying to move the *.boto file into the Jenkins root but I can't see a *.boto file (Windows install).


Cheers

J

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2b36d956-bb1e-4b05-aaae-47dcee1bd03c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.