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

Enhancement #136 - Dynamic flow creation for workers #137

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

Conversation

harishtm
Copy link

If this pull request fixes a bug or resolves a feature, please link to that issue (e.g. fixes: #1).

Copy link
Member

@fridex fridex left a comment

Choose a reason for hiding this comment

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

I really like this, thanks! What I would probably change to make it more generic:

Currently the worker is statefull - it keeps configuration of the last run with specified configuration. So if I start selinon with some configuration, it gets overwritten with a run where configuration is passed in run_flow.

From user's perspective, I would maybe expect that if I do not pass configuration to run_flow, there is used the one that was used during start up. If there was passed the config option, it is used only for the requested flow run (and its nested flows).

What do you think?

@@ -162,6 +164,7 @@ def __init__(self, dispatcher_id, flow_name, node_args=None, retry=None, state=N
# Instantiate lazily later if we will know that there is something to process
self._waiting_edges = []
self._retry = retry
self._config = copy.copy(config)
Copy link
Member

Choose a reason for hiding this comment

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

Why there is needed a copy?

Copy link
Author

@harishtm harishtm Nov 29, 2018

Choose a reason for hiding this comment

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

During parallel execution a different reference of config was needed hence use the copy.

Copy link
Member

Choose a reason for hiding this comment

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

Was it process level parallel execution?

Copy link
Author

Choose a reason for hiding this comment

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

yes, it for each individual process

selinon/run.py Outdated
config_module['dispatcher_queues'] = Config.dispatcher_queues
config_module['task_queues'] = Config.task_queues
config_module['nodes_definition'] = nodes_definition
config_module['flow_definitions'] = flow_definitions
Copy link
Member

@fridex fridex Nov 29, 2018

Choose a reason for hiding this comment

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

This could be accomplished by setting the config using set_config_dict, but see my review comments above.

Copy link
Author

Choose a reason for hiding this comment

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

As the request is dispatched from the run, the configuration would not be available at celery execution. Hence tried updating the Config class, which will make use of the node, flow definition and reconstruct the Config.

Copy link
Member

Choose a reason for hiding this comment

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

Agree, these values should be sufficient to kick-off flow run from message producer. My comment was more on reusing the logic from set_config_dict, but I see your point.

Copy link
Author

Choose a reason for hiding this comment

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

Hi Fridex,

Thank you, yes set_config_dict method can be reused and i have modified the PR. Please review

@harishtm
Copy link
Author

Hi fridex,

Ya i agree that under run_flow if no configuration is provided then flow should consider the default configuration during startup. I would change the run_flow method.

Thanks,

Harish

@harishtm
Copy link
Author

harishtm commented Dec 3, 2018

Hi Fridex,

Any suggestion on this pull request that needs to be modified or we are good to go with merge. I tried executing test case as well but i am getting few errors. Please suggest how to proceed.

Thanks & Regards
Harish

@fridex
Copy link
Member

fridex commented Dec 3, 2018

There seem to be linting issues - see reports in Travis CI - for example - https://travis-ci.org/selinon/selinon/jobs/461193958. Could you take a look at them?

I would like to have some tests for this so we make sure this feature does not break with any of the future releases and add this feature to docs - I can make this happen in my spare time. Please make sure there is checked "Allow edits from maintainers." on the right panel.

Thanks again for your contribution!

@fridex
Copy link
Member

fridex commented Dec 3, 2018

Also, I think the worker looks statefull with this change - see my comments above.

@harishtm
Copy link
Author

harishtm commented Dec 4, 2018

Hi Fridex,

There are no pylint errors from the files which i have modified have attached the screen short for reference

Thanks & Regards,
Harish
selinon_pylint

@fridex
Copy link
Member

fridex commented Dec 4, 2018

There are no pylint errors from the files which i have modified have attached the screen short for reference.

I set up Travis CI to make these things reproducible - see the Travis CI reports here - https://travisci.org/selinon/selinon/pull_requests in pull request 137 (or ckick on "Details" in the checks window below this comment in failed checks). I use some custom configurations of pylint.

Thank you, yes set_config_dict method can be reused and i have modified the PR. Please review

Thanks, it looks good to me.

Thanks for your time!
F.

@harishtm
Copy link
Author

harishtm commented Dec 4, 2018

Hi Fridex,

Sorry i am not able to get the custom configuration w.r.t pylint and the link provided above is not working. Please let me know the custom configuration changes so that i can fix those pylilnt issues.

Thanks & Regards
Harish

@fridex
Copy link
Member

fridex commented Dec 4, 2018

Oh, sorry. The link was incorrectly copied - https://travis-ci.org/selinon/selinon/pull_requests

@harishtm
Copy link
Author

harishtm commented Dec 5, 2018

Hi Fridex,

I was not able to find the pylint issues and i tried configuring in my local as well but those warning what i am getting is not because of the changes that i have made in my PR. could you please help me in fixing pylint issues. I have attached the screen shot of pylint running in my local.
pylintlocal

@fridex
Copy link
Member

fridex commented Dec 5, 2018

You can try to run make check with pylint being installed. If there are still some issues, don't bother with them, I'll take a look.

@fridex
Copy link
Member

fridex commented Dec 5, 2018

Master should be fixed in #138. You can rebase to see if issues persist.

@codecov
Copy link

codecov bot commented Dec 6, 2018

Codecov Report

Merging #137 into master will decrease coverage by 0.06%.
The diff coverage is 58.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #137      +/-   ##
==========================================
- Coverage   68.25%   68.18%   -0.07%     
==========================================
  Files          62       62              
  Lines        4136     4149      +13     
==========================================
+ Hits         2823     2829       +6     
- Misses       1313     1320       +7
Impacted Files Coverage Δ
selinon/system_state.py 94.3% <100%> (+0.01%) ⬆️
selinon/task_envelope.py 50.87% <33.33%> (-1.86%) ⬇️
selinon/run.py 66.66% <42.85%> (-11.12%) ⬇️
selinon/dispatcher.py 74.19% <80%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba72dbf...42d6e82. Read the comment docs.

@harishtm
Copy link
Author

harishtm commented Dec 6, 2018

Hi Fridex,

Thank you very much for the help pylint issues have been fixed and build has passes but it has failed with the test coverage. Please let me know what to do on those issues.

Thanks & Regards
Harish

@harishtm
Copy link
Author

Hi Fridex,

May i know the status of the above Pull Request.

Thanks & Regards
Harish

@fridex
Copy link
Member

fridex commented May 9, 2019

Oh, I'm really sorry - somehow I missed notification around this one. The only concern I have is the behavior when a worker is started with some configuration which gets overwritten with this approach.

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.

Introduce fast-path fallback
2 participants