Skip to content

Instantly share code, notes, and snippets.

@paul-english
Last active August 29, 2015 14:11
Show Gist options
  • Save paul-english/e14d714749e9df7ad7ae to your computer and use it in GitHub Desktop.
Save paul-english/e14d714749e9df7ad7ae to your computer and use it in GitHub Desktop.
import xml.etree.ElementTree as ET
@shared_task
def test_et():
print('test_et')
fpath = '<xml-file>'
t = ET.parse(fpath)
print('--- t', t)
> ./manage.py celery inspect stats
{
"broker": {
"alternates": [],
"connect_timeout": 4,
"heartbeat": null,
"hostname": "localhost",
"insist": false,
"login_method": null,
"port": 6379,
"ssl": false,
"transport": "redis",
"transport_options": {
"fanout_patterns": true,
"fanout_prefix": true,
"visibility_timeout": 3600
},
"uri_prefix": null,
"userid": null,
"virtual_host": "1"
},
"clock": "30",
"pid": 24842,
"pool": {
"max-concurrency": 16,
"max-tasks-per-child": "N/A",
"processes": [
392,
394,
403,
417,
435,
445,
466,
488,
498,
508,
518,
531,
548,
564,
574,
584
],
"put-guarded-by-semaphore": false,
"timeouts": [
0,
0
],
"writes": {
"all": "",
"avg": "0.00%",
"inqueues": {
"active": 0,
"total": 16
},
"raw": "",
"total": 0
}
},
"prefetch_count": 64,
"rusage": {
"idrss": 0,
"inblock": 0,
"isrss": 0,
"ixrss": 0,
"majflt": 0,
"maxrss": 100484,
"minflt": 45242,
"msgrcv": 0,
"msgsnd": 0,
"nivcsw": 173,
"nsignals": 0,
"nswap": 0,
"nvcsw": 1970,
"oublock": 16,
"stime": 0.384,
"utime": 1.7839999999999998
},
"total": {}
}
sudo gdb /opt/<app>/.venv/bin/python
> attach 3035
Reading symbols from /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_type_utils.so...(no debugging symbols found)...done.
Loaded symbols for /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_type_utils.so
Reading symbols from /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_flexible_type.so...(no debugging symbols found)...done.
Loaded symbols for /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_flexible_type.so
Reading symbols from /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_dataframe.so...(no debugging symbols found)...done.
Loaded symbols for /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_dataframe.so
Reading symbols from /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_graph.so...(no debugging symbols found)...done.
Loaded symbols for /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_graph.so
Reading symbols from /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_model.so...(no debugging symbols found)...done.
Loaded symbols for /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_model.so
Reading symbols from /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_variant.so...(no debugging symbols found)...done.
Loaded symbols for /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_variant.so
Reading symbols from /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_sketch.so...(no debugging symbols found)...done.
Loaded symbols for /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/cy_sketch.so
Reading symbols from /lib/x86_64-linux-gnu/libnss_files.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/x86_64-linux-gnu/libnss_files.so.2
Reading symbols from /lib/x86_64-linux-gnu/libnss_dns.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/x86_64-linux-gnu/libnss_dns.so.2
Reading symbols from /opt/<app>/.venv/local/lib/python2.7/site-packages/tornado/speedups.so...done.
Loaded symbols for /opt/<app>/.venv/local/lib/python2.7/site-packages/tornado/speedups.so
Reading symbols from /opt/<app>/.venv/lib/python2.7/lib-dynload/_curses.so...(no debugging symbols found)...done.
Loaded symbols for /opt/<app>/.venv/lib/python2.7/lib-dynload/_curses.so
Reading symbols from /lib/x86_64-linux-gnu/libncursesw.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib/x86_64-linux-gnu/libncursesw.so.5
Reading symbols from /lib/x86_64-linux-gnu/libtinfo.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib/x86_64-linux-gnu/libtinfo.so.5
Reading symbols from /opt/<app>/.venv/local/lib/python2.7/site-packages/_billiard.so...done.
Loaded symbols for /opt/<app>/.venv/local/lib/python2.7/site-packages/_billiard.so
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fff821de000
0x00007fbdb20470fe in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
(gdb)
(gdb) step
Single stepping until exit from function pthread_cond_timedwait@@GLIBC_2.3.2,
which has no line number information.
0x00007fbd9aa5e24f in boost::future_status boost::detail::basic_future<libfault::message_reply*>::wait_for<long, boost::ratio<1l, 1l> >(boost::chrono::duration<long, boost::ratio<1l, 1l> > const&) const ()
from /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/libbase_dep.so
(gdb) step
Single stepping until exit from function _ZNK5boost6detail12basic_futureIPN8libfault13message_replyEE8wait_forIlNS_5ratioILl1ELl1EEEEENS_13future_statusERKNS_6chrono8durationIT_T0_EE,
which has no line number information.
0x00007fbd9aa59bee in cppipc::comm_client::internal_call(cppipc::call_message&, cppipc::reply_message&, bool) () from /opt/<app>/.venv/local/lib/python2.7/site-packages/graphlab/cython/libbase_dep.so
(gdb) step
Single stepping until exit from function _ZN6cppipc11comm_client13internal_callERNS_12call_messageERNS_13reply_messageEb,
which has no line number information.
step
$ ./manage.py celery worker -c1
# in another shell
$ ./manage.py celery inspect stats
# then start strace
$ sudo strace <pid>
# lastly call the task
$ ./manage.py celery call <django-app-name>.tasks.test_et
stat("/opt/<app>/.venv/src/pyodbc/pyexpat.so", 0x7fff11786e70) = -1 ENOENT (No such file or directory)
stat("/opt/<app>/.venv/src/pyodbc/pyexpat.dylib", 0x7fff11786e70) = -1 ENOENT (No such file or directory)
stat("/opt/<app>/.venv/lib/python2.7/pyexpat.so", 0x7fff11786e70) = -1 ENOENT (No such file or directory)
stat("/opt/<app>/.venv/lib/python2.7/pyexpat.dylib", 0x7fff11786e70) = -1 ENOENT (No such file or directory)
stat("/opt/<app>/.venv/lib/python2.7/plat-linux2/pyexpat.so", 0x7fff11786e70) = -1 ENOENT (No such file or directory)
stat("/opt/<app>/.venv/lib/python2.7/plat-linux2/pyexpat.dylib", 0x7fff11786e70) = -1 ENOENT (No such file or directory)
stat("/opt/<app>/.venv/lib/python2.7/lib-tk/pyexpat.so", 0x7fff11786e70) = -1 ENOENT (No such file or directory)
stat("/opt/<app>/.venv/lib/python2.7/lib-tk/pyexpat.dylib", 0x7fff11786e70) = -1 ENOENT (No such file or directory)
stat("/opt/<app>/.venv/lib/python2.7/lib-old/pyexpat.so", 0x7fff11786e70) = -1 ENOENT (No such file or directory)
stat("/opt/<app>/.venv/lib/python2.7/lib-old/pyexpat.dylib", 0x7fff11786e70) = -1 ENOENT (No such file or directory)
stat("/opt/<app>/.venv/lib/python2.7/lib-dynload/pyexpat.so", {st_mode=S_IFREG|0644, st_size=65040, ...}) = 0
stat("/opt/<app>/.venv/lib/python2.7/lib-dynload/pyexpat.so", {st_mode=S_IFREG|0644, st_size=65040, ...}) = 0
rt_sigaction(SIGINT, NULL, {SIG_IGN, [], SA_RESTORER, 0x7fae05e4dcb0}, 8) = 0
rt_sigaction(SIGINT, {0x7fadee85a1f0, [], SA_RESTORER, 0x7fae05e4dcb0}, NULL, 8) = 0
futex(0x5ced9dc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, {1419038053, 643442612}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
futex(0x5ced9b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x5ced9dc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 3, {1419038056, 643758556}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
futex(0x5ced9b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x5ced9dc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 5, {1419038059, 644074245}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
futex(0x5ced9b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x5ced9dc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 7, {1419038062, 644413190}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
futex(0x5ced9b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x5ced9dc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 9, {1419038065, 644746500}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
futex(0x5ced9b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x5ced9dc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 11, {1419038068, 645087693}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
futex(0x5ced9b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x5ced9dc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 13, {1419038071, 645360353}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
futex(0x5ced9b0, FUTEX_WAKE_PRIVATE, 1) = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment