import BAC0
bacnet = BAC0.connect()
my_obj_list = [('file', 1),
('analogInput', 1002),
('analogInput', 1),
('analogInput', 1006),
('analogInput', 1011),
('analogInput', 1010),
('analogInput', 1001)]
# # Provide it as an argument
fx = BAC0.device('16102:19', 1610219, bacnet, object_list = my_obj_list)
p=fx.points
for point in p:
print(point)
The code is returning the point values as expected, but throwing an exception. Can not figure out what I'm doing wrong.
error
2018-11-26 17:45:51,864 - INFO | Starting BAC0 version 0.99.944 (Lite)
2018-11-26 17:45:51,908 - INFO | Using ip : 192.168.0.16
2018-11-26 17:45:51,909 - INFO | Starting app...
2018-11-26 17:45:51,910 - INFO | BAC0 started
2018-11-26 17:45:51,910 - INFO | Registered as Simple BACnet/IP App
2018-11-26 17:45:54,529 - INFO | Changing device state to DeviceDisconnected'>
2018-11-26 17:45:54,726 - INFO | Changing device state to RPDeviceConnected'>
2018-11-26 17:45:54,928 - INFO | Device 1610219:[device1610219] found... building points list
2018-11-26 17:45:57,674 - INFO | Ready!
2018-11-26 17:45:57,676 - INFO | Polling started, values read every 10 seconds
Exception in thread rpm_poll:
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:_website\BacTest\venv\lib\site-packages\BAC0\tasks\TaskManager.py", line 45, in run
self.process()
File "C:_website\BacTest\venv\lib\site-packages\BAC0\tasks\TaskManager.py", line 52, in process
self.task()
File "C:_website\BacTest\venv\lib\site-packages\BAC0\tasks\Poll.py", line 77, in task
self.device.read_multiple(list(self.device.points_name), points_per_request=25)
File "C:_website\BacTest\venv\lib\site-packages\BAC0\core\devices\mixins\read_mixin.py", line 452, in read_multiple
self.read_single(each,points_per_request=1, discover_request=discover_request)
File "C:_website\BacTest\venv\lib\site-packages\BAC0\core\devices\mixins\read_mixin.py", line 459, in read_single
return self.properties.network.read(request)
File "C:_website\BacTest\venv\lib\site-packages\BAC0\core\io\Read.py", line 87, in read
args_split, arr_index=arr_index, vendor_id=vendor_id, bacoid=bacoid))
File "C:_website\BacTest\venv\lib\site-packages\BAC0\core\io\Read.py", line 310, in build_rp_request
addr, obj_type, obj_inst, prop_id = args[:4]
ValueError: not enough values to unpack (expected 4, got 2)
device1610219/ai_2 : 2.30 noUnits
device1610219/zone_temp : 45.00 degreesFahrenheit
device1610219/ai_6 : 75.00 degreesFahrenheit
device1610219/ai_11 : 1.00 65535
device1610219/ai_10 : -53.30 degreesFahrenheit
device1610219/ai_1 : 0.00 noUnits
Process finished with exit code 0
I've made some tests trying to replicate your bug and I think you may be fighting with a weird device.
Using the exact same script I succeed reading all points.
If I may suggest though, declaring your device using default "poll" parameters will assure reading of all points every 10 seconds.
Using points will force a reading of points (one by one) when called which will slow the process. For that, I would use point.lastValue
When the device polls its point list, internally, it'll use a ReadPropertyMultiple that will read a bunch of points and properties at the same time. It is more efficient.
Something like (playing with format...) :
import BAC0
bacnet = BAC0.lite()
# # Provide it as an argument
fx = BAC0.device('2:5', 5, bacnet)
for name in fx.points_name:
if fx[name].units:
val = '{:>10.2f}'.format(fx[name].lastValue)
units = fx[name].units
else:
units = '({})'.format(fx[name].properties.units_state)
val = '{:>10}'.format(fx[name].lastValue)
print('{:<20} : {} {:<10}'.format(fx[name].properties.name, val, units))
(Extract of result)
2018-12-06 20:43:17,167 - INFO | Starting BAC0 version 0.99.944 (Lite)
2018-12-06 20:43:17,283 - INFO | Using ip : 192.168.210.11
2018-12-06 20:43:17,285 - INFO | Starting app...
2018-12-06 20:43:17,292 - INFO | BAC0 started
2018-12-06 20:43:17,292 - INFO | Registered as Simple BACnet/IP App
2018-12-06 20:43:19,295 - INFO | Changing device state to DeviceDisconnected'>
2018-12-06 20:43:20,156 - INFO | Changing device state to RPMDeviceConnected'>
2018-12-06 20:43:20,716 - INFO | Device 5:[FX14 0005] found... building points
2018-12-06 20:43:32,691 - INFO | Ready!
2018-12-06 20:43:32,696 - INFO | Polling started, values read every 10 seconds
nvoAI3 : -1.17 degreesCelsius
nvoAI4 : 42.33 percent
nvoAI6 : 354.00 kilopascals
nvoAI5 : 1.85 percent
nvoAI1 : 22.05 degreesCelsius
nvoAI2 : 20.84 degreesCelsius
[...]
nciOvrdDO5.State : 1 (['AUTO', 'ON', 'OFF'])
nvoAlarmPompe : 1 (['OFF', 'ON'])
nvoAlrmGravePompe : 1 (['OFF', 'ON'])
nvoTempOccup : 1 (['OFF', 'ON'])
nciModeOperation : 2 (['ARRET', 'AUTO', 'CHAUFF', 'REFROID', 'ELECTR'])
nciOvrdDO2.State : 1 (['AUTO', 'ON', 'OFF'])
nciOvrdDO3.State : 1 (['AUTO', 'ON', 'OFF'])
nciOvrdDO4.State : 1 (['AUTO', 'ON', 'OFF'])
nciOvrdDO1.State : 1 (['AUTO', 'ON', 'OFF'])
nciModeDeshum : 1 (['Aucune', 'Ventilation', 'Rechauff'])
nciOvrdAO1.State : 2 (['AUTO', 'MAN', '100', '0'])
nciOvrdAO2.State : 1 (['AUTO', 'MAN', '100', '0'])
nvoDI7 : inactive (('Off', 'On'))
nvoDI8 : inactive (('Off', 'On'))
nvoDI10 : inactive (('Off', 'On'))
nvoDI9 : inactive (('Off', 'On'))
nvoDI6 : inactive (('Off', 'On'))
nvoDI4 : inactive (('Off', 'On'))
If you keep getting issues, please post one here : https://github.com/ChristianTremblay/BAC0/issues
Related
Even if I type "since" keyword in ccxt bitget, always get only the latest information. The same code worked on ftx, what's the problem?
bitget = ccxt.bitget({'apiKey' : self.KEY,
'secret' : self.SECRET_KEY,
'enableRateLimit' : True,
'options' : {'defaultType':'swap'}
})
yyyymmdd = '20220301'
since = int(datetime(int(yyyymmdd[:4]),int(yyyymmdd[4:6]),int(yyyymmdd[6:])).timestamp()*1000)
ohlcv = bitget.fetch_ohlcv('BTC/USDT', '1m', since, limit = 1000)
ohlcv = pd.DataFrame(ohlcv)
ohlcv.columns = ['time','open','high','low','close','volume']
ohlcv['time'] = ohlcv['time'].apply(lambda x : datetime.fromtimestamp(x/1000).strftime('%Y%m%d %H:%M'))
time open high low close volume
0 20220322 14:36 42957.24 42959.97 42927.88 42927.88 1.8439
1 20220322 14:37 42927.88 42957.04 42927.88 42951.36 1.2933
2 20220322 14:38 42951.36 42951.36 42928.46 42932.59 0.6664
3 20220322 14:39 42932.59 42938.0 42916.22 42916.22 2.0336
4 20220322 14:40 42916.22 42916.22 42891.29 42897.49 2.0132
5 20220322 14:41 42897.49 42900.14 42880.96 42884.51 1.6279
6 20220322 14:42 42884.51 42893.26 42870.46 42870.46 2.3478
.
.
.
How can I get specific time period information ?
maybe since=since
also millisecond unix
since = int(datetime.datetime.strptime("2021-05-18 11:20:00+00:00", "%Y-%m-%d %H:%M:%S%z").timestamp() * 1000)
EDIT: looks like your unix was right my bad
I am trying to insert dataframe into a table .Is there any other way to fast insert dataframe into DB Table having Various datatypes.
My code:
import pandas as pd
from sqlalchemy.engine import create_engine
from sqlalchemy import types
import cx_Oracle
DIALECT = 'oracle'
SQL_DRIVER = 'cx_oracle'
USERNAME = 'NCSWEB' #enter your username
PASSWORD = '#####' #enter your password
HOST = '192.168.213.151' #enter the oracle db host url
PORT = 1515 # enter the oracle port number
SERVICE = 'devnc12c' # enter the oracle db service name
ENGINE_PATH_WIN_AUTH = DIALECT + '+' + SQL_DRIVER + '://' + USERNAME + ':' + PASSWORD +'#' + HOST + ':' + str(PORT) + '/?service_name=' + SERVICE
engine = create_engine(ENGINE_PATH_WIN_AUTH,max_identifier_length=128)
print(engine)
#read data from csv
fileName='C:\\Users\\ncdex1124\Desktop\\New folder\\file4.csv'
df = pd.read_csv(fileName)
print(df)
dtyp = {c:types.VARCHAR(df[c].str.len().max())
for c in df.columns[df.dtypes == 'object'].tolist()}
try:
engine = engine.connect().execution_options(autocommit=True)
df.to_sql('UCIDBA.FUT_CLIENT_LIST_COPY', con=engine, if_exists='append', index=False, chunksize=10000,dtype=dtyp)
print("Record inserted successfully")
except Exception as e:
print(e)
While Executing The above Script I am Getting Following Error
PS C:\Users\ncdex1124> & C:/Users/ncdex1124/AppData/Local/Programs/Python/Python39/python.exe D:\test\insertcsvscript.py
Engine(oracle+cx_oracle://NCSWEB:***#192.168.213.151:1515/?service_name=devnc12c)
CL_SEQ CL_TMID CL_CLIENT_ID CL_PAN CL_CLI_STATUS CL_PAN_STATUS CL_ACTION_TYPE CL_CREATED_DATE CL_CREATED_BY CL_MODIFIED_DATE CL_MODIFIED_BY
0 3793375 21 MEN0008 ARJPP6330Q A V 0 9/6/2019 14:23 SYSTEM 9/9/2019 11:28 SYSTEM
1 3793378 8 AACCB1987D AACCB1987D A V 0 9/7/2019 14:23 SYSTEM 9/10/2019 11:28 SYSTEM
2 3793381 10 AABCI2081G AABCI2081G A V 0 9/8/2019 14:23 SYSTEM 9/11/2019 11:28 SYSTEM
3 3793383 11 AABCN9894G AABCN9894G A V 0 9/9/2019 14:23 SYSTEM 9/12/2019 11:28 SYSTEM
4 3793387 12 AAACM0267F AAACM0267F A V 0 9/10/2019 14:23 SYSTEM 9/13/2019 11:28 SYSTEM
... ... ... ... ... ... ... ... ... ... ... ...
180011 3793368 185 AACCC0537F AACCC0537F A V 0 7/14/2512 14:23 SYSTEM 9/6/2019 14:24 SYSTEM
180012 3793369 161 AAACP7015P AAACP7015P A V 0 7/15/2512 14:23 SYSTEM 9/6/2019 14:24 SYSTEM
180013 3793370 159 AAACA8392E AAACA8392E A V 0 7/16/2512 14:23 SYSTEM 9/6/2019 14:24 SYSTEM
180014 3793371 167 AACCC5501F AACCC5501F A V 0 7/17/2512 14:23 SYSTEM 9/6/2019 14:24 SYSTEM
180015 3793372 168 AAHCS7515E AAHCS7515E A V 0 7/18/2512 14:23 SYSTEM 9/6/2019 14:24 SYSTEM
[180016 rows x 11 columns]
Error closing cursor
Traceback (most recent call last):
File "C:\Users\ncdex1124\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1751, in _execute_context
self.dialect.do_executemany(
File "C:\Users\ncdex1124\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\dialects\oracle\cx_oracle.py", line 1347, in do_executemany
cursor.executemany(statement, parameters)
cx_Oracle.DatabaseError: DPI-1080: connection was closed by ORA-3135
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ncdex1124\AppData\Local\Programs\Python\Python39\lib\site-packages\sqlalchemy\engine\base.py", line 1866, in _safe_close_cursor
cursor.close()
cx_Oracle.DatabaseError: DPI-1010: not connected
(cx_Oracle.DatabaseError) DPI-1010: not connected
(Background on this error at: https://sqlalche.me/e/14/4xp6)
The DB Table Structure looks like this
CL_SEQ NUMBER
CL_TMID VARCHAR2(5 BYTE)
CL_CLIENT_ID VARCHAR2(10 BYTE)
CL_PAN VARCHAR2(10 BYTE)
CL_CLI_STATUS CHAR(1 BYTE)
CL_PAN_STATUS CHAR(2 BYTE)
CL_ACTION_TYPE VARCHAR2(1 BYTE)
CL_CREATED_DATE DATE
CL_CREATED_BY VARCHAR2(10 BYTE)
CL_MODIFIED_DATE DATE
CL_MODIFIED_BY VARCHAR2(10 BYTE)
What am I doing wrong here .Or Is there any other way ?
This script is supposed to open a telnet session with a remote device, send a command, and write the output to a file. The CC and CA stand for Ctrl + C and Ctrl + A. The only possible explanation that I can come up with is that the remote device is not sending the Ctrl+C at the end, but the shell output shows that it is.
Code:
#!/usr/bin/python
#Import external modules
import sys
import socket
import telnetlib
import datetime
import csv
import logging
import os
#Import internal variables and functions
from ctrlchar import CA,CC
#import csv file siteProfiles.csv
with open("/home/dev/iotank/site-profiles-staging.csv") as f:
reader = csv.reader(f, delimiter=',')
data = []
for row in reader:
data.append(row)
#Variables
TIMEOUT=30 #Telnet timeout in seconds
#251 is CSLD Report, 301 Liquid Sensor Status Report, 201 is Inventory Report
COMMAND="I201"
DEVICE="00"
DATE=datetime.date.today()
TIME=datetime.datetime.now()
TIMESTAMP=TIME.strftime("%m%d%Y%H%M")
sites = len(data)
logging.basicConfig(filename='log.txt',level=logging.DEBUG)
logger= logging.getLogger("basiclog")
REPORTNAME="TESTFI" + TIMESTAMP + ".txt"
file = open("/home/dev/iotank/report/inventory/" + REPORTNAME, 'w+')
for row in xrange(sites):
SITE = data[row][0]
HOST = data[row][1]
PORT = data[row][2]
BEGINREPORT=COMMAND + DEVICE
try:
tn = telnetlib.Telnet(HOST,PORT,TIMEOUT)
tn.set_debuglevel(1)
tn.write(CA)
tn.write(COMMAND)
tn.write(DEVICE)
tn.read_until("TEMP")
file.write("z" + SITE + "\r\n" + TIMESTAMP)
file.write(tn.read_until(CC))
tn.close
file.seek(-2, os.SEEK_END)
file.truncate()
except Exception:
logger.error(SITE + HOST + "Couldn't connect", exc_info=True)
file.close()
Output:
z080
121720190130
1 ULTRA LOW DIESEL 12175 0 2929 90.17 1.70 63.77
2 DYED LSDF 3345 0 970 65.44 0.00 63.61
3 UNLEAD 1002 0 5014 21.44 0.00 70.17
4 SUPER 1078 0 2901 30.33 1.69 70.19
^A
I20100
DEC 17, 2019 2:27 AM
US 280 FUEL CENTER
IN-TANK INVENTORY
TANK PRODUCT VOLUME TC VOLUME ULLAGE HEIGHT WATER TEMP
1 ULTRA LOW DIESEL 12175 0 2929 90.17 1.70 63.79
2 DYED LSDF 3345 0 970 65.44 0.00 63.61
3 UNLEAD 1002 0 5014 21.44 0.00 70.15
4 SUPER 1078 0 2901 30.33 1.69 70.20
The top 6 lines before the Ctrl+A character is the desired output. Why does the code continue through another iteration.
You need parentheses after the tn.close. Python isn't like Ruby or Lua, you have to explicitly call the function.
tn.close # gives the value of the function (<bound method Whatever.close of <Whatever object at 0x0000d15ea5e>>
tn.close() # calls the function
I am trying to use Jenkins python api to retrieve all the Job runs for a particular Job like, if the job is successful or if the job is failed I need to know at what stage it failed. Currently I am able to get, if the job is successful or failure. I am unable to get the stage at which job failed.
import jenkins
import re
from datetime import datetime
startDate = int(datetime(2019, 8, 18).strftime('%s'))
endDate = int(datetime(2019, 8, 21).strftime('%s'))
server = jenkins.Jenkins('jenkins_url', username='admin',
password='admin')
info = server.get_job_info(jobname)
TotalSuccess=0
TotalFailure=0
TotalAborted=0
TotalNone=0
TotalUNKNOW=0
TotalUnstable=0
builds = info['builds']
for build in builds:
BuildStatus=server.get_build_info(jobname, build['number'])
Result=BuildStatus['result']
BuildNumber=BuildStatus['number']
TimeStamp=BuildStatus['timestamp']
TimeStamp=TimeStamp/1000
build_date=datetime.utcfromtimestamp(TimeStamp).strftime('%Y-%m-%d %H:%M:%S')
if (TimeStamp > startDate) & (TimeStamp < endDate):
print ("Result=",Result,"BuildID=",BuildNumber,'Build Time: ',str(build_date))
if Result == "SUCCESS":
TotalSuccess += 1
elif Result == "UNSTABLE":
TotalUnstable += 1
elif Result == "FAILURE":
TotalFailure += 1
elif Result == "ABORTED":
TotalAborted += 1
elif Result == "None":
TotalNone += 1
else:
TotalUNKNOW += 1
else:
break
print ("Total Number of Success Builds=",TotalSuccess)
print ("Total Number of UnStable Builds=",TotalUnstable)
print ("Total Number of Failure Builds=",TotalFailure)
print ("Total Number of Aborted Builds=",TotalAborted)
print ("Total Number of Unknown Builds=",TotalUNKNOW)
print ("On Going Builds=",TotalNone)
Current Output
Result= None BuildID= 196 Build Time: 2019-08-26 23:14:50
Result= SUCCESS BuildID= 195 Build Time: 2019-08-26 17:16:20
Result= SUCCESS BuildID= 194 Build Time: 2019-08-24 22:00:13
Result= SUCCESS BuildID= 193 Build Time: 2019-08-24 12:53:26
Result= FAILURE BuildID= 192 Build Time: 2019-08-24 07:00:11
Total Number of Success Builds= 3
Total Number of UnStable Builds= 0
Total Number of Failure Builds= 1
Total Number of Aborted Builds= 0
Total Number of Unknown Builds= 1
On Going Builds= 0
Expected
Result= None BuildID= 196 Build Time: 2019-08-26 23:14:50 StageFailed= None
Result= SUCCESS BuildID= 195 Build Time: 2019-08-26 17:16:20 StageFailed= NONE
Result= SUCCESS BuildID= 194 Build Time: 2019-08-24 22:00:13 StageFailed= NONE
Result= SUCCESS BuildID= 193 Build Time: 2019-08-24 12:53:26 StageFailed= NONE
Result= FAILURE BuildID= 192 Build Time: 2019-08-24 07:00:11 StageFailed= deploy
Total Number of Success Builds= 3
Total Number of UnStable Builds= 0
Total Number of Failure Builds= 1
Total Number of Aborted Builds= 0
Total Number of Unknown Builds= 1
On Going Builds= 0
You can use wfapi to get stage names and build information.
import requests
url = "https://my-jenkins-url/job/<job-name>/lastBuild/wfapi/"
response = requests.request("GET", url)
data = response.json()
print (data['stages'])
print (data['id'])
print (data['status'])
Output:
id': '88', 'name': 'example_stage_name', 'execNode': '', 'status': 'SUCCESS', 'startTimeMillis': 1580767070144, 'durationMillis': 140011, 'pauseDurationMillis': 0},'SUCCESS', 'startTimeMillis': 1580795569817, 'durationMillis': 32985, 'pauseDurationMillis': 0},
386
FAILED
I'm getting the following backtrace in my uWSGI logs, I don't know where to begin looking to figure this out:
Thu Feb 12 17:08:18 2015 - mapping worker 1 to CPUs: 0
Thu Feb 12 17:09:40 2015 - WSGI app 0 (mountpoint='') ready in 82 seconds on interpreter 0x129e3d0 pid: 21930 (default app
Thu Feb 12 17:10:11 2015 - *** HARAKIRI ON WORKER 1 (pid: 21930, try: 1) ***
Thu Feb 12 17:10:11 2015 - *** backtrace of 21930 ***
app(uwsgi_backtrace+0x2e) [0x45121e]
app(what_i_am_doing+0x30) [0x451350]
/lib/x86_64-linux-gnu/libc.so.6(+0x36d40) [0x7feea1becd40]
/lib/x86_64-linux-gnu/libc.so.6(__select+0x33) [0x7feea1ca8933]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x984ed) [0x7feea092f4ed]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x4bd4) [0x7feea09f70d4]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d) [0x7feea09f917d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x162310) [0x7feea09f9310]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x7d30d) [0x7feea091430d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x513c8) [0x7feea08e83c8]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x2316) [0x7feea09f4816]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d) [0x7feea09f917d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x1623e5) [0x7feea09f93e5]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0xeb1) [0x7feea09f33b1]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d) [0x7feea09f917d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x1623e5) [0x7feea09f93e5]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0xeb1) [0x7feea09f33b1]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d) [0x7feea09f917d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x162310) [0x7feea09f9310]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_CallFunctionObjArgs+0x141) [0x7feea097bb61]
/var/www/app/env/local/lib/python2.7/site-packages/newrelic-2.42.0.35/newrelic/packages/wrapt/_wrappers.so(+0x416c) [0x7fee9e18516c]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0xeb1) [0x7feea09f33b1]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d) [0x7feea09f917d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x48d8) [0x7feea09f6dd8]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d) [0x7feea09f917d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x1623e5) [0x7feea09f93e5]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0xeb1) [0x7feea09f33b1]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d) [0x7feea09f917d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x162310) [0x7feea09f9310]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_CallFunctionObjArgs+0x141) [0x7feea097bb61]
/var/www/app/env/local/lib/python2.7/site-packages/newrelic-2.42.0.35/newrelic/packages/wrapt/_wrappers.so(+0x448a) [0x7fee9e18548a]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x2316) [0x7feea09f4816]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d) [0x7feea09f917d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x162310) [0x7feea09f9310]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x7d30d) [0x7feea091430d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(+0x12e5f5) [0x7feea09c55f5]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7feea09c0e23]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_CallObjectWithKeywords+0x47) [0x7feea097f837]
/usr/lib/uwsgi/plugins/python_plugin.so(python_call+0x11) [0x7feea0e0e4f1]
/usr/lib/uwsgi/plugins/python_plugin.so(uwsgi_request_wsgi+0x127) [0x7feea0e10847]
app(wsgi_req_recv+0xa1) [0x413f31]
app(simple_loop_run+0xc4) [0x44d5d4]
app(uwsgi_ignition+0x17b) [0x45180b]
app(uwsgi_worker_run+0x26d) [0x4523ad]
app(uwsgi_start+0x15e3) [0x453b23]
app(main+0xfb5) [0x413595]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7feea1bd7ec5]
app() [0x413649]
*** end of backtrace ***
Thu Feb 12 17:10:11 2015 - HARAKIRI: --- uWSGI worker 1 (pid: 21930) WAS managing request /v3/remoco/now_next since Thu Feb 12 17:09:40 2015 ---
Thu Feb 12 17:10:13 2015 - *** HARAKIRI ON WORKER 1 (pid: 21930, try: 2) ***
Thu Feb 12 17:10:14 2015 - DAMN ! worker 1 (pid: 21930) died, killed by signal 9 :( trying respawn ...
Thu Feb 12 17:10:14 2015 - Respawned uWSGI worker 1 (new pid: 21985)
Thu Feb 12 17:10:14 2015 - mapping worker 1 to CPUs: 0
I thought maybe the newrelic lines might have something to do with it so I disabled newrelic on the machines but I get the same backtrace without the newrelic lines.
I'm running uWSGI version 1.9.17.1-debian on Ubuntu 14.04 and all updates have been applied.
This is my uWSGI app config:
[uwsgi]
; define variables to use in this script
; process name for easy identification in top
project = app
base_dir = /var/www/%(project)
chdir = %(base_dir)
plugins = python
virtualenv = %(base_dir)/env
uid = www-data
gid = www-data
procname = %(project)
; This value needs to be tuned
workers = 12
max-request = 40000
harakiri = 30
reload-mercy = 8
cpu-affinity = 2
reload-on-as = 512
reload-on-rss = 192
no-orphans = true
master = true
; Create pid file for easier process management
pidfile2 = %(base_dir)/run/%(project).pid
; Specify your app here
wsgi-file = %(base_dir)/project/%(project)-wsgi.py
log-reopen = true
logto2 = %(base_dir)/logs/uwsgi.log
chmod-socket = 666
vacuum = true
enable-threads = true
single-interpreter = true
lazy-apps = true
buffer-size=32768
; unix socket
socket = /tmp/%(project)-server.sock
; Enable stats
stats = /tmp/%(project)-stats.sock
Let me know if there is anything else I can add to this and I will.