Skip to content
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

Added parallel search logic #10

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Added parallel search logic #10

wants to merge 6 commits into from

Conversation

OleguerCanal
Copy link
Member

Hey guys (@fedetask @CarolinaBianchi @cserranocolome ), so the code is pure garbage but I use it a lot and I wanted to have parallel optimization
So in an effort to make it a bit cleaner I refactored it a bit and added a ParallelSearcher class which schedules calls to SearchJobInstance abstract class.
This SearchJobInstance has to be implemented by the user populating functions to launch a particular job, check if it is finished, get the result and this sort of stuff

Let me know if you have any comments on this (or if you care at all) otherwise I'll just merge it to master. One day it would be nice to make a major cleanup of this repo though

Copy link
Member

@fedetask fedetask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I don't spot any obvious problem at this moment.

One question about the stile: in SearchJobInstance you used the type hints for the return value like def fun(args) -> float:, do you think it would make sense to consistently use it in all functions? (Along with argument type hints)

Other than that, I like the idea of letting the user define the job class.

Copy link
Collaborator

@CarolinaBianchi CarolinaBianchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Left one minor comment

Comment on lines +34 to +44
@abstractmethod
def kill(self) -> None:
"""Finish job
"""
raise NotImplementedError

@abstractmethod
def end(self) -> None:
"""Run any task necessary when done
"""
raise NotImplementedError
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these two functions called by anyone? If not, I would not include them in the abstract SearchJobInstance

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not called now. I thought they might be useful but you are right, they are not needed.

I'll remove them for now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants