def apply(self, job, pipeline=False, overwrite=False):
    'Apply this profile to the given job.'
    log.debug('Profiles | Applying job profile to %s', job)
    if overwrite:
        self.apply_overwrite(job)
        return
    if (not pipeline):
        job.name = self._render_job_name(job)
    elif (self.name is not None):
        log.info('Apply pipeline name to job: %s %s', job, self.name)
        job.pipeline = self._render(job, self.name)
    if (self.threads and (job.threads is None)):
        job.threads = int(self.threads)
    if ((self.nodes is not None) and (job.nodes is None)):
        job.nodes = self.nodes
    if ((self.tasks is not None) and (job.tasks is None)):
        job.tasks = self.tasks
    if ((self.tasks_per_node is not None) and (job.tasts_per_node is None)):
        job.tasks_per_node = self.tasks_per_node
    if ((self.environment is not None) and (job.environment is None)):
        job.environment = self.environment
    if ((self.queue is not None) and (job.queue is None)):
        job.queue = self.queue
    if ((self.priority is not None) and (job.priority is None)):
        job.priority = self.priority
    if ((self.time is not None) and (job.max_time is None)):
        job.max_time = jip.utils.parse_time(self.time)
    if (self.mem is not None):
        if (job.max_memory is None):
            job.max_memory = 0
        job.max_memory += jip.utils.parse_mem(self.mem)
    if ((self.log is not None) and (job.stderr is None)):
        job.stderr = self._render(job, self.log)
    if ((self.out is not None) and (job.stdout is None)):
        job.stdout = self._render(job, self.out)
    if ((self.account is not None) and (job.account is None)):
        job.account = self.account
    if ((self.temp is not None) and (job.temp is None)):
        job.temp = self.temp
    if ((self.extra is not None) and (job.extra is None)):
        job.extra = self.extra
    if ((self.working_dir is not None) and (job.working_directory is None)):
        job.working_directory = os.path.abspath(self.working_dir)
    if (job.stdout and (not job.stdout.startswith('/'))):
        job.stdout = os.path.join(job.working_directory, job.stdout)
    if (job.stderr and (not job.stderr.startswith('/'))):
        job.stderr = os.path.join(job.working_directory, job.stderr)
    if self.env:
        current = os.environ.copy()
        if job.env:
            current.update(job.env)
        rendered = {}
        for (k, v) in self.env.iteritems():
            rendered[k] = render_template(v, **current)
        job.env.update(rendered)
    if hasattr(job, 'pipe_to'):
        for child in job.pipe_to:
            self.apply(child)
Apply this profile to the given job.
def apply(self, job, pipeline=False, overwrite=False):
    
    log.debug('Profiles | Applying job profile to %s', job)
    if overwrite:
        self.apply_overwrite(job)
        return
    if (not pipeline):
        job.name = self._render_job_name(job)
    elif (self.name is not None):
        log.info('Apply pipeline name to job: %s %s', job, self.name)
        job.pipeline = self._render(job, self.name)
    if (self.threads and (job.threads is None)):
        job.threads = int(self.threads)
    if ((self.nodes is not None) and (job.nodes is None)):
        job.nodes = self.nodes
    if ((self.tasks is not None) and (job.tasks is None)):
        job.tasks = self.tasks
    if ((self.tasks_per_node is not None) and (job.tasts_per_node is None)):
        job.tasks_per_node = self.tasks_per_node
    if ((self.environment is not None) and (job.environment is None)):
        job.environment = self.environment
    if ((self.queue is not None) and (job.queue is None)):
        job.queue = self.queue
    if ((self.priority is not None) and (job.priority is None)):
        job.priority = self.priority
    if ((self.time is not None) and (job.max_time is None)):
        job.max_time = jip.utils.parse_time(self.time)
    if (self.mem is not None):
        if (job.max_memory is None):
            job.max_memory = 0
        job.max_memory += jip.utils.parse_mem(self.mem)
    if ((self.log is not None) and (job.stderr is None)):
        job.stderr = self._render(job, self.log)
    if ((self.out is not None) and (job.stdout is None)):
        job.stdout = self._render(job, self.out)
    if ((self.account is not None) and (job.account is None)):
        job.account = self.account
    if ((self.temp is not None) and (job.temp is None)):
        job.temp = self.temp
    if ((self.extra is not None) and (job.extra is None)):
        job.extra = self.extra
    if ((self.working_dir is not None) and (job.working_directory is None)):
        job.working_directory = os.path.abspath(self.working_dir)
    if (job.stdout and (not job.stdout.startswith('/'))):
        job.stdout = os.path.join(job.working_directory, job.stdout)
    if (job.stderr and (not job.stderr.startswith('/'))):
        job.stderr = os.path.join(job.working_directory, job.stderr)
    if self.env:
        current = os.environ.copy()
        if job.env:
            current.update(job.env)
        rendered = {}
        for (k, v) in self.env.iteritems():
            rendered[k] = render_template(v, **current)
        job.env.update(rendered)
    if hasattr(job, 'pipe_to'):
        for child in job.pipe_to:
            self.apply(child)