You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using boolean_parser to handle text parsing to convert into SQLAlchemy queries, in Flask application, I was occassionally getting the error: TypeError: Condition.__init__() missing 1 required positional argument: 'data'
I checked through all of my code, to make sure everything was correctly formatting the input string. Everything I could find in my code was throughly vetted.
Then I thought since it was a multi threaded app, perhaps this issue laid in the parser itself. I presumed the parser would be creating a new instance of parser each time. It seems to be doing that using the "parse()" method to create the correct base parser.
However given the following code, it crashes almost immediately the same way:
`if name == 'main':
from boolean_parser import parse as boolean_parser
from multiprocessing.dummy import Pool
test_string ="(owner_id == 418f5230-365f-4867-9721-0bd498968932)"
test_list = [test_string for t in range(0, 1000)]
with Pool(5) as p:
print(p.map(boolean_parser, test_list))
`
The multiprocessing.dummy class is the same as using the Threading class, just makes it easy to switch back and forth.
If you were to run the list through a standard map function, it would execute correctly. If you use just the multiprocessing module it also just works. I love the functionality of this package, and I can probably get a work around figured out, but would prefer to get this working. This happens in 1.4 and 1.5 beta.
The text was updated successfully, but these errors were encountered:
@mrmessagewriter is this still an issue? Sorry for the long delay in responding. Yeah I didn't have multi-threading in mind when initially creating the package. I can take a look but if you have a workaround or solution already implemented, feel free to submit a PR for review.
Ahh well yeah the solution is to wrap multiprocess to manage a group of threads, each executing as a single unique thread. It is not a great solution, but also not part of the boolean_parser itself.
Using boolean_parser to handle text parsing to convert into SQLAlchemy queries, in Flask application, I was occassionally getting the error:
TypeError: Condition.__init__() missing 1 required positional argument: 'data'
I checked through all of my code, to make sure everything was correctly formatting the input string. Everything I could find in my code was throughly vetted.
Then I thought since it was a multi threaded app, perhaps this issue laid in the parser itself. I presumed the parser would be creating a new instance of parser each time. It seems to be doing that using the "parse()" method to create the correct base parser.
However given the following code, it crashes almost immediately the same way:
`if name == 'main':
`
The multiprocessing.dummy class is the same as using the Threading class, just makes it easy to switch back and forth.
If you were to run the list through a standard map function, it would execute correctly. If you use just the multiprocessing module it also just works. I love the functionality of this package, and I can probably get a work around figured out, but would prefer to get this working. This happens in 1.4 and 1.5 beta.
The text was updated successfully, but these errors were encountered: