(analysis, user=None, json_text='', json_data={}, name=None, state=Job.QUEUED, uid=None, save=True,
               fill_with={})
return job
Note: Parameter 'fill_with' needs to be a flat key:value dictionary.
Note: Parameter 'fill_with' needs to be a flat key:value dictionary.
Note : Parameter fill_with needs to be a flat key : value dictionary .
def create_job(analysis, user=None, json_text='', json_data={}, name=None, state=Job.QUEUED, uid=None, save=True,
               fill_with={}):
    """
    Note: Parameter 'fill_with' needs to be a flat key:value dictionary.
    """
    state = state or Job.QUEUED
    owner = user or analysis.project.owner
    project = analysis.project

    if json_data:
        json_text = hjson.dumps(json_data)
    else:
        json_text = json_text or analysis.json_text

    # Needs the json_data to set the summary.
    json_data = hjson.loads(json_text)

    # Generate a meaningful job title.
    name = make_job_title(recipe=analysis, data=json_data)
    uid = uid or util.get_uuid(8)

    # Create the job instance.
    job = Job.objects.create(name=name, state=state, json_text=json_text,
                             security=Job.AUTHORIZED, project=project, analysis=analysis, owner=owner,
                             template=analysis.template, uid=uid)
    # Fill the json data.
    json_data = fill_json_data(job=job, source_data=json_data, project=project, fill_with=fill_with)

    # Generate a meaningful job title.
    name = make_job_title(recipe=analysis, data=json_data)
    # Update the json_text and name
    job.json_text = hjson.dumps(json_data)
    job.name = name

    # Append parameter summary to job on creation.
    job.text = f"{job.text}\n{job.parameter_summary}"
    job.html = mistune.markdown(text=job.text, escape=False)

    if save:
        # Save the updated json_text and name.
        job.save()
        # Update the projects lastedit user when a job is created
        logger.info(f"Created job id={job.id} name={job.name}")

    return job
def create_job ( analysis , user = None , json_text = '' , json_data = { } , name = None , state = Job . QUEUED , uid = None , save = True , fill_with = { } ) : state = state or Job . QUEUED owner = user or analysis . project . owner project = analysis . project if json_data : json_text = hjson . dumps ( json_data ) else : json_text = json_text or analysis . json_text # Needs the json_data to set the summary. json_data = hjson . loads ( json_text ) # Generate a meaningful job title. name = make_job_title ( recipe = analysis , data = json_data ) uid = uid or util . get_uuid ( 8 ) # Create the job instance. job = Job . objects . create ( name = name , state = state , json_text = json_text , security = Job . AUTHORIZED , project = project , analysis = analysis , owner = owner , template = analysis . template , uid = uid ) # Fill the json data. json_data = fill_json_data ( job = job , source_data = json_data , project = project , fill_with = fill_with ) # Generate a meaningful job title. name = make_job_title ( recipe = analysis , data = json_data ) # Update the json_text and name job . json_text = hjson . dumps ( json_data ) job . name = name # Append parameter summary to job on creation. job . text = f"{job.text}\n{job.parameter_summary}" job . html = mistune . markdown ( text = job . text , escape = False ) if save : # Save the updated json_text and name. job . save ( ) # Update the projects lastedit user when a job is created logger . info ( f"Created job id={job.id} name={job.name}" ) return job