Skip to content

Pylint cleanup#143

Merged
shivaram merged 6 commits into
masterfrom
pylint
Jul 8, 2017
Merged

Pylint cleanup#143
shivaram merged 6 commits into
masterfrom
pylint

Conversation

@shivaram
Copy link
Copy Markdown
Collaborator

@shivaram shivaram commented Jul 3, 2017

This PR contains changes to address warnings from Pylint. Right now this includes removing trailing whitespace and organizing the imports.

@shivaram
Copy link
Copy Markdown
Collaborator Author

shivaram commented Jul 3, 2017

There are still some more warnings left. The current output of running pylint --rcfile ./pylintrc pywren is at https://gist.github.com/shivaram/039511355e726ea7a277f51d3032e1ac
Some of these warnings are simple to fix (like the print formatting).

The other warnings of relative import seem more tricky to fix as from my testing we rely on relative imports to get the lambda runner to work correctly.

Also @ooq @ericmjonas it would be good if you could look at the list of disabled checks at https://github.com/pywren/pywren/blob/pylint/pylintrc#L84 and see if something should be enabled.

@shivaram
Copy link
Copy Markdown
Collaborator Author

shivaram commented Jul 4, 2017

Ok I enabled a bunch of more rules and fixed issues raised in them. https://gist.github.com/shivaram/5e297f237fabd268b860f367fb2f9331 is the latest remaining errors.

Some of the remaining ones are about unused variables which I am a bit hesitant to change in this PR as that will need more careful reviewing ?

@ooq
Copy link
Copy Markdown
Collaborator

ooq commented Jul 7, 2017

You have more commits on this, right? @shivaram

@shivaram
Copy link
Copy Markdown
Collaborator Author

shivaram commented Jul 7, 2017

I will rebase this with @Vaishaal's recently merged PR. I have some more commits to follow that make some more code changes -- Should we do this in this same PR or do it in a follow up PR ?

@ooq
Copy link
Copy Markdown
Collaborator

ooq commented Jul 7, 2017

I think the idea of having a "safe" PR that requires minimal code change, and a follow up PR that finalizes lint, is pretty reasonable. We can pass the first one very quickly.

@shivaram
Copy link
Copy Markdown
Collaborator Author

shivaram commented Jul 7, 2017

Great. Then I will stash the other commits. Can you take a look at the existing ones ? I'll just push one more commit with the rebase

@shivaram
Copy link
Copy Markdown
Collaborator Author

shivaram commented Jul 7, 2017

Seems like a flaky test run - Value (pywren_travis_589_7_052493) for parameter iamInstanceProfile.name is invalid. Invalid IAM Instance Profile name - Re-triggering the tests

@shivaram
Copy link
Copy Markdown
Collaborator Author

shivaram commented Jul 7, 2017

@ooq - tests pass now

Copy link
Copy Markdown
Collaborator

@ooq ooq left a comment

Choose a reason for hiding this comment

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

Looks all good, except one comment on how SQSInvoker should be imported. Thanks for the PR, it's quite some lines!

Comment thread pywren/wren.py
SQS_QUEUE = config['standalone']['sqs_queue_name']
invoker = invokers.SQSInvoker(AWS_REGION, SQS_QUEUE)
invoker = queues.SQSInvoker(AWS_REGION, SQS_QUEUE)

Copy link
Copy Markdown
Collaborator

@ooq ooq Jul 7, 2017

Choose a reason for hiding this comment

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

Is this caused by import changes due to lint? I feel previous code was cleaner in that all invokers are from invokers.py.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure how this was working before. From what I can see SQSInvoker is only present in queues.py ? So was it somehow being imported by invokers.py and then re-exported ? I could try to revert this and see if lint and tests are happy, but I'm also curious what the intended behavior here is

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the invokers should be a module and the queues.py just provide some implementations. So it's nice to access all invokers from invokers.py.
Personally I feel having a separatequeues.py file is not very necessary for now, but we might expand more in the future.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does lint complain if you revert back?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

So to do this I think we need to import SQSInvoker into invokers.py ? If I do that then I get W: 9, 0: Unused SQSInvoker imported from pywren.queues (unused-import) in invokers.py.

If I dont do that import then I get E: 61,14: Module 'pywren.invokers' has no 'SQSInvoker' member (no-member)

Again -- I'm not sure having the class in queues.py is a good idea if we want to call it from invokers.py (if we need a module we need to create invokers as a directory ? that seems overkill)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Agree that would overkill.
Another way is to wrap SQSInvoker in invokers.py (We probably want to change the naming as well, having a invoker inside a queue.py is not ideal). But this should not be in this PR.
I'm fine with merging.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok cool. I just fixed one minor thing due to a merge conflict with vaishaal's PR. Feel free to merge once the tests pass !

@shivaram shivaram merged commit 9d8096c into master Jul 8, 2017
@Vaishaal Vaishaal deleted the pylint branch November 28, 2018 04:18
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.

2 participants