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 a Task wrapper for MicroSoft OpenPAI #2531

Merged
merged 11 commits into from Feb 26, 2019

Conversation

liudongqing
Copy link
Contributor

Description

Microsoft OpenPAI Job wrapper for Luigi.
Add luigi/contrib/pai.py
Add test/contrib/pai_test.py

Motivation and Context

Microsoft OpenPAI Job wrapper for Luigi.

"OpenPAI is an open source platform that provides complete AI model training and resource management capabilities,
it is easy to extend and supports on-premise, cloud and hybrid environments in various scale."

For more information about OpenPAI : https://github.com/Microsoft/pai/

Have you tested this? If so, how?

Tested in our local open pai cluster.

Copy link
Collaborator

@dlstadther dlstadther left a comment

Choose a reason for hiding this comment

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

Thanks for submitting @liudongqing

I have a number of comments to make, but before i go into detail i wanted to provide some high level thoughts and questions.

  1. Could you explain the __slots__ usage and __slot_to_dict()?
  2. When a class property is required to be overriden, decorate it with @abc.abstractproperty.
  3. You have a mix of camelCase and snake_case instance variables. Can we stick to just one? Preferably, snake_case.
  4. On multiple occasions, you reference an element of a Request response before verifying that it returned with a valid HTTP code such to contain text or json
  5. Similarly, verify that the contents include what you expect. (Looking at the token instantiation here - will that POST response always include a token key in the response?)

@liudongqing
Copy link
Contributor Author

@dlstadther Thanks for your comments, see my response below:

  1. The PaiJob/TaskRole/Port represent the OpenPAI Job structure, use slots to make sure no attributes other than predefined ones. __slot_to_dict() used to json.dump as default function serialize the PaiJob object.
  2. Done.
  3. The camelCase was used in he PaiJob/TaskRole/Port to make sure the attribute name are same as OpenPAI job. Other than that, I use snake_case to follow python convention.
  4. Added some checkings.
  5. It should always have the same attributes when the response status_code are 200.

@liudongqing
Copy link
Contributor Author

@dlstadther any new comments?

@dlstadther
Copy link
Collaborator

Sorry @liudongqing I'll try to re-review this this week. Thanks for following up!

luigi/contrib/pai.py Show resolved Hide resolved
luigi/contrib/pai.py Outdated Show resolved Hide resolved
luigi/contrib/pai.py Show resolved Hide resolved
luigi/contrib/pai.py Outdated Show resolved Hide resolved
luigi/contrib/pai.py Show resolved Hide resolved
test/contrib/pai_test.py Show resolved Hide resolved
test/contrib/pai_test.py Outdated Show resolved Hide resolved
1) correct/add more doc strings.
2) raise exception when 404
3) use global logger directly.
4) change expiration to integer
@liudongqing
Copy link
Contributor Author

@dlstadther Thanks for your comments, sorry for delayed response due to a long vacation.

@liudongqing
Copy link
Contributor Author

@dlstadther , could you please help to follow? Thanks!

Copy link
Collaborator

@dlstadther dlstadther left a comment

Choose a reason for hiding this comment

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

Mostly just some visual cleanup.

But do still have hesitations about the unittest.

test/contrib/pai_test.py Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
test/contrib/pai_test.py Outdated Show resolved Hide resolved
luigi/contrib/pai.py Outdated Show resolved Hide resolved
test/contrib/pai_test.py Outdated Show resolved Hide resolved
@liudongqing
Copy link
Contributor Author

liudongqing commented Oct 18, 2018

The unittests failed, looks like requests lib got an issued Urllib3 1.24. I checked the master branch, it failed as well.

@liudongqing
Copy link
Contributor Author

@dlstadther passed UT by adding the requests>=2.20.0 per comment in the issue.

Copy link
Collaborator

@dlstadther dlstadther left a comment

Choose a reason for hiding this comment

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

Thanks so much for your prompt fixes. I believe this is the last thing from me! :)

test/contrib/pai_test.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@dlstadther dlstadther left a comment

Choose a reason for hiding this comment

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

I think this LGTM now

@liudongqing
Copy link
Contributor Author

@dlstadther Thanks! Any more actions I need to take to merge that or just waiting someone to do it at convenience time?

@stale
Copy link

stale bot commented Feb 18, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If closed, you may revisit when your time allows and reopen! Thank you for your contributions.

@stale stale bot added the wontfix label Feb 18, 2019
@dlstadther
Copy link
Collaborator

@liudongqing I'm so sorry this fell off my radar! I noted this was ready to merge and i meant to do so. Could you update the merge conflict so that i can merge?

@stale stale bot removed the wontfix label Feb 18, 2019
@dlstadther
Copy link
Collaborator

Thanks so much @liudongqing !

@dlstadther dlstadther merged commit 6f32570 into spotify:master Feb 26, 2019
@liudongqing liudongqing deleted the contrib/pai branch March 1, 2019 07:03
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