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

Implement promised requirements (resolves #729) #791

Closed
wants to merge 1 commit into from
Closed

Implement promised requirements (resolves #729) #791

wants to merge 1 commit into from

Conversation

jpfeil
Copy link
Contributor

@jpfeil jpfeil commented Apr 13, 2016

Resolves #729

@hannes-ucsc hannes-ucsc changed the title Promised Requirement (resolves #729) Implement promised requirements (resolves #729) Apr 13, 2016
@hannes-ucsc
Copy link
Member

Commit message is wrong.

:type memory: int or string convertable by bd2k.util.humanize.human2bytes to an int
"""
self.cores = cores
:type cores: int; Can also accept a PromisedRequirement object
Copy link
Member

Choose a reason for hiding this comment

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

:param int|str cores: ...

Copy link
Member

Choose a reason for hiding this comment

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

Read PEP 0484 for a specification . The PyCharm support web site has a page about type hinting, too.

@hannes-ucsc
Copy link
Member

You need to modify setup.py and mention dill as a requirement.

@@ -254,6 +298,32 @@ def encapsulate(self):
"""
return EncapsulatedJob(self)


@staticmethod
def update_kwargs(kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

If you modify kwargs in place you shouldn't return it. Returning it would indicate to the caller that you return a copy and that you didn't touch the argument, but 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.

The name of this method is too unspecific.

resolves #729

Implemented PromisedRequirement class for dynamically allocating job
function resources.

.
@@ -1654,3 +1757,29 @@ def promisedJobReturnValueUnpickleFunction(jobStoreString, jobStoreFileID):
copy_reg.pickle(PromisedJobReturnValue,
promisedJobReturnValuePickleFunction,
promisedJobReturnValueUnpickleFunction)


class PromisedRequirement(object):
Copy link
Member

Choose a reason for hiding this comment

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

Document the class, including its use as a callable.

@jpfeil
Copy link
Contributor Author

jpfeil commented Apr 13, 2016

Jenkins, test this please.


def increment_counter(filepath):
"""
Without the second argument, increment counter, sleep one second and decrement.
Copy link
Member

Choose a reason for hiding this comment

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

What second argument? This comment is redundant. The code below says the same thing, and is actually more accurate since here you say that it waits for 1s which isn't true.

@hannes-ucsc
Copy link
Member

Alright, so the main things are:

I don't like how you handle promise_disk etc, i.e. the shadow attributes. Ideally, I would want to get rid of them.

I'm worried that resetting the requirements to the default values will have unintended consequences. The single machine batch system implements a strict FIFO regime and looks at the requirements very late. The Mesos batch system puts jobs into separate queues, based on their requirements, so it looks at them earlier.

Now that I am saying it, your tests should be executed against every batch system. You can either leave your tests in a separate module and replicate the structure of the existing batch system tests. Or you add your tests to the existing batch system tests. I think I'd prefer the former.

@hannes-ucsc
Copy link
Member

We might not be able to support static DAGs. And we might have to defer the submission of a job with promised requirements to until after the promises have been resolved.

@hannes-ucsc
Copy link
Member

And keep this branch rebased on master, once per day.

@hannes-ucsc
Copy link
Member

@jpfeil, PR #823 is under review by @benedictpaten, so we might not get to merging it today. It failed for unrelated reasons but passes your test and all other tests that could be affected by promises. You may just want to rebase this branch onto the branch for #823 avoid being blocked that way. Also, if I were you, I would ditch your personal fork and start pushing directly to the upstream. The fact that the branch for #818 was in your fork—to which I can't push—made it necessary for me to close #818 and start #823 in its place.

@jpfeil
Copy link
Contributor Author

jpfeil commented Apr 28, 2016

Continued in #828

@jpfeil jpfeil closed this Apr 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants