Suppose a a container contains a gaseous mixture of methane and hydrogen. The mixture effuses out through a hole in the container. Now hydrogen is lighter gas so it must effuse faster and all of hydrogen should come out of the flask earlier than methane (before all methane effuses out) and a stage should come when there is only methane left in the container. Is this how it happens?
Sort of, but not quite.
If our hole is large (say, as if pierced by a toothpick), then the gases will go out in pretty much the same composition that is found inside, so their ratio in the mixture will stay nearly the same till the very end.
If the hole is small, about the size of free path of a molecule in a gas, then it's a different story. BTW, these conditions are called Knudsen flow. Methane weighs 16, and helium weighs 4 (I know you've said "hydrogen", but let's assume it was helium, just to make the calculations easier). So helium particles are 4 times lighter than those of methane, hence they fly 2 times faster. So there would be two times as many of them in the outgoing stream - that is, if the mixture inside was 1:1. See, it's not like all helium flows outside, while methane molecules stand politely in the line, saying "After you".
As the story progresses (which is not going to be fast with just one tiny hole), the mixture inside gets enriched with methane. So does the outgoing flow, but still it remains richer in helium relative to the mixture inside, and hence continues to shift its composition in the same direction. Yet still, pure methane is a limit which is never actually attained.
That being said, pressing gas mixtures through porous membranes is a valid way to separate the components by molecular mass regardless of their chemical properties, and as such, was used for isotope enrichment.