Skip to content

Resolves #1321 fixing service deadlocks - #1338

Merged
benedictpaten merged 2 commits into
masterfrom
issues-1321-fixing-service-deadlocks-rebased
Nov 30, 2016
Merged

benedictpaten merged 2 commits into
masterfrom
issues-1321-fixing-service-deadlocks-rebased

Conversation

@benedictpaten

Copy link
Copy Markdown
Contributor

No description provided.

@benedictpaten

Copy link
Copy Markdown
Contributor Author

jenkins, test this please

@benedictpaten
benedictpaten force-pushed the issues-1321-fixing-service-deadlocks-rebased branch 2 times, most recently from 42cff88 to 5ff1c1c Compare November 28, 2016 00:21
@benedictpaten benedictpaten changed the title Issues 1321 fixing service deadlocks rebased Resolves #1321 fixing service deadlocks Nov 28, 2016
@benedictpaten

Copy link
Copy Markdown
Contributor Author

Not sure why the last tests timed out. Any clues @cket @hannes-ucsc ?

@benedictpaten

Copy link
Copy Markdown
Contributor Author

Seems like this branch is slower. I will do some performance probing.

@hannes-ucsc

Copy link
Copy Markdown
Member

Due to the parallel nature of the tests it is hard to determine which test timed out. We should change run_tests.sh to pipe output through sed -e 's/^/WHATTEST/:

#1342

Just by staring at the output, I can tell that CGCloudRestartTest was running while timeout occurred but that all other tests had passed. @cket remind me to explain my reasoning. It's possible that that tests simply hung.

@benedictpaten

Copy link
Copy Markdown
Contributor Author

Okay, the tests passed this time, I'm squashing the commits then (assuming it passes), I'd like @cket or @hannes-ucsc to review and get this in. I want to work on testing of spark services next - @fnothaft what's happened with the docs pr?

- Fixes deadlocks as described in #1321.
- Refactors leader class to combine jobBatcher and leader functions into
combined leader class, cleaning up state.
- Puts statsAndLogging and serviceManager in their own files, to slim
leader.py
- Fixes some bugs in clusterScaler.py, notably that scheduling algorithm
was not properly doing first fit decreasing binpacking
- Fixes serialization bug for passing promised between jobs in
multi-stage service clusters
- Adds documentation describing deadlock issues for services.
- Adds simple test for deadlock detection
- Removes redundant copy of toilState object (we had two!)
- Improves jobTest to include services in random dags.
@benedictpaten
benedictpaten force-pushed the issues-1321-fixing-service-deadlocks-rebased branch from 9d9a288 to d94c306 Compare November 29, 2016 17:42

@cket cket left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My main point of confusion is why this is using average time and the number of service jobs to manage deadlocks instead of looking at the ratio of service jobs to total jobs. It seems to me that looking at the average historical time for all jobs is too broad to accurately detect service deadlocks, and could potentially result in over-provisioning of the cluster.

Also, some of these files are missing newlines at the end.

Comment thread src/toil/common.py

# Parameters to limit service jobs, so preventing deadlock scheduling scenarios
self.maxPreemptableServiceJobs = sys.maxint
self.maxServiceJobs = sys.maxint

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Using the ratio of services/total jobs would let you set a reasonable default here instead of maxint, which won't prevent any deadlocks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct, I did not enable this by default because I was worried about it making weird side effects. I prefer this conservative approach until we have tested it at scale.

Comment thread src/toil/leader.py
self.serviceJobsToBeIssued.append(jobNode)
self.issueQueingServiceJobs()

def issueQueingServiceJobs(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wouldn't this make more sense in the service manager? It took me a while to find this code

Comment thread src/toil/leader.py Outdated
@staticmethod
def statsAndLoggingAggregator(jobStore, stop):
# Represents a job and its requirements as issued to the batch system
IssuedJob = namedtuple("IssuedJob", "jobStoreID memory cores disk preemptable")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't used anywhere, I think it was removed in the job name PR. Maybe reintroduced in a merge error?

Comment thread src/toil/provisioners/clusterScaler.py Outdated

:param toil.job.JobNode job: The memory, core and disk requirements of the completed job

:param IssuedJob job: The memory, core and disk requirements of the completed job

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Merge error? The old type hint was correct but the comment was wrong. 'job' is now just a jobNode object not a tuple.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup, fixing.


# Make correction, if necessary (only do so if cluster is busy and average runtime is higher than historical
# average)
if runtimeCorrection != 1.0:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This would be unnecessary if we limited the ratio of services issued, right? It seems like there are a lot of scenarios where this would be triggered without being in a deadlock.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This will be triggered a bunch, but I still think it's a better way to adjust our prior on how long we expect the cluster to run. Remember when we first start up the cluster it can take ages before it has a decent set of jobs to properly estimate the runtime of queued jobs. This heuristic will tend to increase the cluster size to tackle this case.

@benedictpaten

Copy link
Copy Markdown
Contributor Author

@cket providing the tests complete, are you okay with doing a merge?

@cket

cket commented Nov 30, 2016

Copy link
Copy Markdown
Contributor

@benedictpaten yes, you answered my main question about the runtime based scaling. Once we have real autoscaling data we can start adjusting any scaling algorithms, if needed

@benedictpaten

Copy link
Copy Markdown
Contributor Author

Good, agree about putting in better defaults for max services down the road.

@benedictpaten
benedictpaten merged commit c0aa2e4 into master Nov 30, 2016
@ejacox
ejacox deleted the issues-1321-fixing-service-deadlocks-rebased branch September 21, 2017 22:49
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.

3 participants