'Persist job destination params in the database for recovery.
self.job_destination is not used because a runner may choose to rewrite
parts of the destination (e.g. the params).'

def set_job_destination(self, job_destination, external_id=None, flush=True, job=None):

    if (job is None):
        job = self.get_job()
    log.debug(('(%s)    Persisting    job    destination    (destination    id:    %s)' % (job.id, job_destination.id)))
    job.destination_id = job_destination.id
    job.destination_params = job_destination.params
    job.job_runner_name = job_destination.runner
    job.job_runner_external_id = external_id
    self.sa_session.add(job)
    if flush:
        self.sa_session.flush()
