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

[add] API to Crawly.Manager #118

Merged
merged 5 commits into from
Aug 31, 2020

Conversation

filipevarjao
Copy link
Contributor

In order to expose the spyder Manager this PR adds the API for Crawly.Manager

@filipevarjao filipevarjao mentioned this pull request Jul 9, 2020
lib/crawly/engine.ex Show resolved Hide resolved
def get_manager(spider_name) do
case Map.fetch(running_spiders(), spider_name) do
:error ->
{:error, :spider_non_exist}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Basically it means that the spider is not running atm

lib/crawly/engine.ex Show resolved Hide resolved
{:error, :spider_non_exist}

{:ok, pid_sup} ->
Supervisor.which_children(pid_sup)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might not be needed as you already have a spider here pid here.

@@ -0,0 +1,19 @@
defmodule Crawly.ManagerAPI do
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would want to avoid adding extra modules here. Please put add workers code to the manager gen server.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@@ -0,0 +1,48 @@
defmodule Features.Manager.TestSpider do
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo in a file name.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't it possible to re-use one of already defined test spiders?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this test_spider was defined inside the ManagerTest. I'm splitting it out to a commonplace so others tests can use it

alias Features.Manager.TestSpider

setup do
Application.put_env(:crawly, :concurrent_requests_per_domain, 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not required if you can use the settings override on a spider level.

Copy link
Collaborator

@oltarasenko oltarasenko 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 as I see!

@filipevarjao
Copy link
Contributor Author

cool, could you merge this PR?

Only those with write access to this repository can merge pull requests.

@oltarasenko
Copy link
Collaborator

Sure! Thanks for the contribution @filipevarjao. I wonder if you still have a bit of time to help me with Crawly, or you've got another assignment already?

@oltarasenko oltarasenko merged commit 30656b6 into elixir-crawly:master Aug 31, 2020
@filipevarjao
Copy link
Contributor Author

happy to help, and I would like to help more, do you still interested to investigate it by the benchmark? or is there a different priority now? let me know

@oltarasenko
Copy link
Collaborator

@filipevarjao Yes, I still plan to continue with the benchmark, however now I am a bit limited on time, as we're wrapping up a project. Hope to have a bit more time in 2 weeks time. In any case if you can update the PR for it, it will be helpful. Otherwise I have quite a few open tickets here and in https://github.com/oltarasenko/crawly_ui

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.

None yet

2 participants