# Stuck at the last steps of a stage

**URL:** https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154
**Category:** Hail Query & hailctl
**Created:** [October 31, 2019, 12:55pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154 "2019-10-31T12:55:38Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![knguyen142](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@knguyen142](https://discuss.hail.is/u/knguyen142)
#### Post date: [October 31, 2019, 12:55pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154/1 "2019-10-31T12:55:38Z")

</div>

Hi,

We upgraded to the latest (0.2.26) because the gnomad v3 table is only compatible with 0.2.24 and above. We’re running into issues where it gets stuck at one of the stages `Stage 3: ....(9373 + 5) / 9378]`. This has been reproduced, and on 0.2.24 it stops at Stage 2 but right at the end again.

 ![42%20AM](https://canada1.discourse-cdn.com/flex036/uploads/hail/original/1X/e10c11e1ab62e0d26b57289ac1d927c3dbfd3ed6.png)

 ![52%20AM](https://canada1.discourse-cdn.com/flex036/uploads/hail/original/1X/9838ab297769fe08eb71eb430f2ce6d1ebb882cc.png)

I looked at the logs and couldn’t find any Error or anything except lost workers, but I might not know what to look for.

Any help would be very appreciated.

---

<div class="post-metadata">

### Author: ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)
#### Post date: [October 31, 2019, 1:34pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154/2 "2019-10-31T13:34:17Z")

</div>

if you look at the Spark UI, does it show 5 tasks remaining in progress?

Teh thing to do here is probably turn on Spark speculation.

---

<div class="post-metadata">

### Author: ![knguyen142](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@knguyen142](https://discuss.hail.is/u/knguyen142)
#### Post date: [October 31, 2019, 1:37pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154/3 "2019-10-31T13:37:17Z")

</div>

I looked through the spark ui a bit but couldn’t really decipher it. Is turning on spark speculation just setting `spark.speculation` to true? I’m not sure if the task is just running slowly, we leave it on for 30 minutes even and invariably they just get stuck.

---

<div class="post-metadata">

### Author: ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)
#### Post date: [October 31, 2019, 1:42pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154/4 "2019-10-31T13:42:24Z")

</div>

The stage / task view in the UI might help indicate which tasks are the problem, or if this is a UI bug and something else is to blame.

And yep, `spark.speculation=true` is the right thing

---

<div class="post-metadata">

### Author: ![knguyen142](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@knguyen142](https://discuss.hail.is/u/knguyen142)
#### Post date: [October 31, 2019, 2:04pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154/5 "2019-10-31T14:04:34Z")

</div>

I’ll check that out soon, but here’s something interesting. I’m running the same thing but on 0.2.22 on gnomad v2 table and it seems to be progressing to stage 7 (not sure how the stages differ across versions). So it doesn’t look to be the VCF, is there anything else we can look into?

---

<div class="post-metadata">

### Author: ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)
#### Post date: [October 31, 2019, 3:52pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154/6 "2019-10-31T15:52:13Z")

</div>

hmm, weird. What’s the pipeline?

---

<div class="post-metadata">

### Author: ![knguyen142](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@knguyen142](https://discuss.hail.is/u/knguyen142)
#### Post date: [October 31, 2019, 4:52pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154/7 "2019-10-31T16:52:23Z")

</div>

It’s our seqr pipeline that joins the vcf variants with a bunch of annotations from a reference data set.

It looks like setting speculation to true allows it to make progress.

`If set to "true", performs speculative execution of tasks. This means if one or more tasks are running slowly in a stage, they will be re-launched.`

Does the slow task reach a bug or something and needs to be restarted? Why does that fix it?

---

<div class="post-metadata">

### Author: ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)
#### Post date: [October 31, 2019, 4:53pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154/8 "2019-10-31T16:53:45Z")

</div>

This is something we’ve never been able to characterize. Performance should be reproducible, but clearly there are cases where it’s not.

Maybe a Spark executor gets in bad state thrashing memory, maybe something else…

---

<div class="post-metadata">

### Author: ![knguyen142](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@knguyen142](https://discuss.hail.is/u/knguyen142)
#### Post date: [October 31, 2019, 4:54pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154/9 "2019-10-31T16:54:19Z")

</div>

Should that setting be put in the general hailctl or does it affect performance?

---

<div class="post-metadata">

### Author: ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)
#### Post date: [October 31, 2019, 4:55pm UTC](https://discuss.hail.is/t/stuck-at-the-last-steps-of-a-stage/1154/10 "2019-10-31T16:55:16Z")

</div>

I think we’re planning on putting that as a hailctl default, yeah.
