Comments (3)
This is expected behavior. When you run pyq
, q
event loop is blocked in a call to Python's main loop. To avoid this, you should call python from a regular q session. For example:
Server side:
$ q
KDB+ 3.4 2016.06.14 ..
q)p)from pyq import q
q)p)def f(): print 'Hello';return q('42') # make sure to return a K object
q)p)q.f = f # export f to q (make sure not to delete f in python)
q)f() / check that we can call f locally
Hello
42
q)\p 1024 / now open the communication port
Client side:
$ q
KDB+ 3.4 2016.06.14 ..
q)`::1024 "f()"
42
and 'Hello' is printed on the server side.
If you don't want to prefix every line with p)
you can put your python code in a file with .p
extension and load it from q
$ cat f.p
from pyq import q
def f():
print 'Hello'
return q('42')
q.f = f
$ q
KDB+ 3.4 2016.06.14 ..
q)\l f.p
q)f()
Hello
42
from pyq.
Actually, I am using PyQ inside Apache Spark via pyspark, so the server's entry point must be from python.
Can you show me where the event loop is blocked in the python's main loop?
from pyq.
Can you show me where the event loop is blocked in the python's main loop?
At this line in python.q. Note that the pyq
command is more or less q python.q
.
from pyq.
Related Issues (20)
- [Windows] fail to load HOT 14
- pip install pyq fails HOT 2
- Pyq on 64-bit Centos 7 failes with Invalid ELF header HOT 2
- pyq doesn't run faster parallelly HOT 2
- Using PyQ in PyCharm in Windows HOT 8
- No module named 'pyq' in macOs Catalina 10.15.4 HOT 5
- q can't find python package in virtual env HOT 20
- pandas 1.0.3 incompatibility HOT 10
- Running a background q timer within an IPython session HOT 4
- stdout from Python is always behind stdout from Q when direct stdout to a file HOT 2
- PyQ 5.0 conda release for python 3.6 HOT 4
- Best practices for read only QHOME HOT 2
- support for .z.pi HOT 4
- What's The Proper Way To Add A Column To q() Table, From Python List or NumpyArrary? HOT 2
- Unable to install pyq on py3.6 venv HOT 1
- Running pyq in terminal resulting in exit .pyq.run line of code executing from python.q file HOT 5
- Python 3.10 compatiblity HOT 8
- Async messages get queued until sync message HOT 1
- installation error: subprocess-exited-with-error HOT 1
- Is there a way to have q syntax highlighting in cells starting with `%%q` in jupyter notebook? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyq.