-
Notifications
You must be signed in to change notification settings - Fork 21
[Jobs] Split jobs in several files #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Depends on #227. |
373bfb3 to
fc8517e
Compare
|
|
||
| def start_jobs( | ||
| config, | ||
| shared_stats: Dict, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a dict ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a dict. A proxy to a dict managed by a shared memory manager, but it behaves like a dict.
|
|
||
| if ( | ||
| pending["message"]["item_type"] == ItemType.IPFS | ||
| or pending["message"]["type"] == "STORE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use aleph_message.models.MessageType.store ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'm going to create an additional PR with all your suggestions.
|
|
||
| seen_ids: Dict[Tuple, int] = dict() | ||
| gtasks: List[asyncio.Task] = [] | ||
| tasks: List[asyncio.Task] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gtasks refers here to a list of created asyncio tasks, but tasks to a list of coroutines that have not been created/started. We could improve the naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. I want gtasks to disappear though so that will solve the problem entirely.
| messages = await get_chaindata_messages( | ||
| pending["content"], pending["context"], seen_ids=seen_ids | ||
| ) | ||
| if isinstance(messages, list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not if messages ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because that would be too pythonic.
Split the `jobs.py` file and put each separate job in its own file. This simplifies the structure of the code. Renamed the subprocesses for pending messages and txs to make them similar.
fc8517e to
bd8e0c1
Compare
Implemented two suggestions from the review of aleph-im#229.
Implemented two suggestions from the review of aleph-im#229.
Implemented two suggestions from the review of #229.
Split the `jobs.py` file and put each separate job in its own file. This simplifies the structure of the code. Renamed the subprocesses for pending messages and txs to make them similar.
Implemented two suggestions from the review of #229.
Split the
jobs.pyfile and put each separate job in its ownfile. This simplifies the structure of the code.
Renamed the subprocesses for pending messages and txs to make
them similar.