Infinite loading in Jenkins when slaves are upgraded to Python 3 - python-3.x

Our team has upgraded our slaves (Windows) from Python 2 to 3. When we try to run our Jenkins jobs, automated test cases were run successfully but we were stuck in xUnitIgnoredTests.py when this part is executing. Infinite loading is encountered when running the job.
enter image description here
We have upgraded our python file with Python 3 syntax. Is there any setup that might be missing?
Thanks.

RDP/connect to an agent and run the command directly. You might be able to get better console output that way.
If you still have Python2 on them run the script with that interpreter too to ensure that something else hasn't changed on the agent that is affecting the script.

Related

Bash Script Fails During Jenkins Build But Does Not Fail Locally

I've been trying to debug this issue all day with no success.
Issue: Bash script executes successfully on a Linux CentOS7 VM (jenkins build agent) but fails during Jenkins build.
Here's the simple script.
#! /bin/bash
echo "before beyond compare command"
bcompare #"bc_report.ps1" "./Output_Base/<Folder_Name>" "./Output_Compare/<Folder Name>" "Report.html"
echo "after beyond compare command"
The output in the Jenkins build log is just:
before beyond compare command
after beyond compare command
When viewing the VM during the Jenkins build, I'm not seeing an artifact being produced. The user during the Jenkins build is Root, when executing the script locally, I'm also doing so as Root with success.
I'm pretty sure this is a Jenkins issue, just can't seem to figure it out. Anyone seen something similar?
Beyond Compare 4 for Linux requires an X-Window/GUI session to run, even for scripts. As a cron job or in an SSH terminal without an X-Window client, Beyond Compare for Linux scripts will fail to run. This might be what is causing your Jenkins job to fail.
Beyond Compare 4 for Windows doesn't have the GUI session requirement for scripts. Beyond Compare 4 for Linux and macOS both require a GUI session for scripts. Removing the GUI session requirement for scripting on Linux and macOS is on the feature request list for a future version.

Subprocess.wait() in Python 2.7 vz Pthon 3.x

I'm just migrating my script from Python27 to Python 394 to run my build process like this:
p = subprocess.Popen(_make_clean, creationflags = subprocess.CREATE_NEW_CONSOLE)
p.wait()
p = subprocess.Popen(_make_rebuild, creationflags = subprocess.CREATE_NEW_CONSOLE)
p.wait()
Was working pretty nice in Python 27 but now I can see in Python 394 the Python script is not waiting for subprocesses. Of course, here it is necessary to wait until the first one (clean) is finished to start the second one (rebuild). I was able to make it work without the flag 'CREATE_NEW_CONSOLE'. Unfortunately, I need to separate the outputs for users to see what is the progress. It is just a mess if all scripts are running in the same console.
Why it is not working any more?
Ok, this is an interesting finding. I'm using ConEmu as my main terminal and it is fully integrated into Windows. In the past, I was NOT running my scripts over this emulated terminal and that seems to be the reason why I have this issue today. ConEmu is opening a new terminal window for each subprocess but in a different way than the native Windows Command-Line. When the script is called over Windows CMD everything is fine.

How to check if a script is already running

How do you check if your script is already running to prevent it from running/opening multiple times.
I am aiming for it to either quit and allow the script to open again or stop the new one from running.
Using:
Python 3.8
Windows 10
File type .pyw
Ide: Thonny
I have looked and haven't been able to find a answer.

How to put python script in AWS?

I want to place my python machine learning code in AWS. Can someone please help me with the procedure. Thank you.
Python script is in .py format.
You have many options available:
You can start your script using EC2's User Data feature
You can use rsync your script to the EC2 instance and run it over SSH
You can build a Docker container in which you would include your script and run a task in ECS
If your script takes less than 15 minutes to execute, you can run it in a Lambda function

Can Jenkins run shell script on agent-less linux host

I am looking for a Jenkins plugin that makes it execute simple shell script into a given machine.
A possible execution of this plugin would be:
Given hostname,username,password, execution folder, and script --> connect to the machine and execute the script.
Can I do it without pre-configuring the machine as Jenkins slave?
I've checked out ssh-plugin and publish-over-ssh but they don't offer doing such thing without preconfiguring the hosts.
So I couldn't find the right built-in solution for Jenkins but Python Fabric is an interesting direction

Resources