Comments (2)
Would it make sense to make the worker class implement the context manager protocol?
Pseudo-python-ish:
class Worker(QueueRemoteCallee):
def __init__(...):
...
self.id = generate_id()
self.storage["current_workers"].insert({"_id": self.id})
def __enter__(self):
return self
def __exit__(self, *args):
self.storage["current_worker"].remove({"_id": self.id})
Usage, in __main__
:
with Worker() as worker:
worker.run()
from mcrit.
I've used your suggestion and implemented worker (de-)registration via context manager, which will be fixed with the soon to be pushed mcrit v1.2.3. Thanks a lot!
from mcrit.
Related Issues (20)
- Limit export
- Add auth to API routes HOT 3
- Add universal tagging
- Generate documentation for McritClient / API
- Configurable UniqueBlocks queries HOT 1
- Index-out-of-range may occur in job's `sample_id` property HOT 1
- Consider adding actors field to families HOT 1
- QoL: Add last index timestamp to server statistics HOT 1
- Add TTL to query_* documents HOT 8
- Question: PicHash and MinHash recalculation results HOT 1
- KeyError on import HOT 2
- recalculateMinHashes progress measure is inaccurate HOT 1
- Exception on POST /query/function HOT 1
- IDA plugin exception printing HOT 1
- Considerations for DbCleanup HOT 1
- Workers consume a lot of ram on query HOT 2
- Binary removal on job deletion might cause issues for certain files
- Use child processes in client
- Cross compare broken HOT 3
- Spawningworker: logging, check if process crashed
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 mcrit.