We are getting errors, our code will stop working several hours in after we are running scheduled tasks every hour to send data to our mysql database we have created on pythonanywhere... So we are getting return code 1 and return code 254, I think that 254 is the one that is killing us. So basically we are dealing with an issue were even though our script doesn't have a loop, sometime our console processes there are like tons of them open. We are doing an ssh tunnel into our db from our code because we can't get it to work any other way. We tried not using a tunnel and it never worked. We keep getting these sshd processes like this sshd: samwins 2021-07-29 at 05:22:56 0. They aren't using any power up but I do think they are causing a problem.
Here is a part of our code you would probably want to see. I took out sensitive info. Can anyone explain why the db task code log is giving an error saying we are out of resources? We do not have it on a loop, other than it's a scheduled task on pythonanywhere. Thanks for the help!
sshtunnel.SSH_TIMEOUT = 21000000.0
sshtunnel.TUNNEL_TIMEOUT = 21000000.0
print("Attempting to connect to database")
with sshtunnel.SSHTunnelForwarder(
('ssh.pythonanywhere.com'),
ssh_username='', ssh_password='"',
remote_bind_address=('s.mysql.pythonanywhere-services.com', 3306)
) as tunnel:
connection = MySQLdb.connect(
user='',
passwd='',
host='127.0.0.1', port=tunnel.local_bind_port,
db='',
)
print("Database Connected!")
#Top 50 Performer Script & Block Winners
for x in addresses:
response = r.get("https://api.helium.io/v1/hotspots/"+x+"/rewards/sum?min_time=-1%20day&bucket=day").text
response_info = json.loads(response)
list_hnt_earned.append(response_info['data'][0]['total'])
response2 = r.get("https://api.helium.io/v1/hotspots/"+x).text
response_info2 = json.loads(response2)
allnodes[response_info2['data']['name']] = response_info['data'][0]['total']
#Go through the dict to filter out top 50 and top 1 performing node
N = 50
top_fifty = dict(sorted(allnodes.items(), key = itemgetter(1), reverse = True)[:N])
M = 1
top_one = dict(sorted(top_fifty.items(), key = itemgetter(1), reverse = True)[:M])
hotspotcursor = connection.cursor()
for key in top_one: #Print out top 1 and top 50 nodes with name and amount of hnt perday
print(key+ " Won the block!")
hotspotcursor.execute("insert into top_performers db mysql info went here")
====Scheduled Task Log===== 2021-07-28 11:46:13 -- Completed task, took 9.54 seconds, return code was 1.
/etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: Resource temporarily unavailable
2021-07-28 12:46:20 -- Completed task, took 17.12 seconds, return code was 254.
/etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: Resource temporarily unavailable
2021-07-28 13:46:20 -- Completed task, took 17.11 seconds, return code was 254.
/etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: Resource temporarily unavailable
2021-07-28 14:46:21 -- Completed task, took 17.68 seconds, return code was 254.
/etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: Resource temporarily unavailable
2021-07-28 15:46:21 -- Completed task, took 17.57 seconds, return code was 254.
/etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: retry: No child processes /etc/bashrc: fork: Resource temporarily unavailable
2021-07-28 16:46:21 -- Completed task, took 17.60 seconds, return code was 254.
Loading Top Performance List... Attempting to connect to database Database Connected!
2021-07-28 17:19:32 -- Completed task, took 148.80 seconds, return code was 0.