@staticmethod
def __setstate__(stateDict):
    """Only called when unpickling. This won't be unpickled unless the
        promise wasn't resolved, so we throw an exception."""
    jobName = stateDict['fulfillingJobName']
    raise RuntimeError(
        "This job was passed a promise that wasn't yet resolved when it ran. The job {jobName} that fulfills this promise hasn't yet finished. This means that there aren't enough constraints to ensure the current job always runs after {jobName}. Consider adding a follow-on indirection between this job and its parent, or adding this job as a child/follow-on of {jobName}."
        .format(jobName=jobName))
