def _insertOrGetUniqueJobNoRetries(<EOL>self, conn, client, cmdLine, jobHash, clientInfo, clientKey, params,<EOL>minimumWorkers, maximumWorkers, jobType, priority, alreadyRunning):
assert len(client) <= self.CLIENT_MAX_LEN, "<STR_LIT>" + repr(client)<EOL>assert cmdLine, "<STR_LIT>" + repr(cmdLine)<EOL>assert len(jobHash) == self.HASH_MAX_LEN, "<STR_LIT>" % len(jobHash)<EOL>if alreadyRunning:<EOL><INDENT>initStatus = self.STATUS_TESTMODE<EOL><DEDENT>else:<EOL><INDENT>initStatus = self.STATUS_NOTSTARTED<EOL><DEDENT>query = '<STR_LIT>''<STR_LIT>''<STR_LIT>''<STR_LIT>''<STR_LIT>'% (self.jobsTableName,)<EOL>sqlParams = (initStatus, client, clientInfo, clientKey, cmdLine, params,<EOL>jobHash, minimumWorkers, maximumWorkers, priority, jobType)<EOL>numRowsInserted = conn.cursor.execute(query, sqlParams)<EOL>jobID = <NUM_LIT:0><EOL>if numRowsInserted == <NUM_LIT:1>:<EOL><INDENT>conn.cursor.execute('<STR_LIT>')<EOL>jobID = conn.cursor.fetchall()[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>if jobID == <NUM_LIT:0>:<EOL><INDENT>self._logger.warn(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>jobType, client, _abbreviate(clientInfo, <NUM_LIT:32>), clientKey, jobHash,<EOL>cmdLine)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>assert numRowsInserted == <NUM_LIT:0>, repr(numRowsInserted)<EOL><DEDENT>if jobID == <NUM_LIT:0>:<EOL><INDENT>row = self._getOneMatchingRowNoRetries(<EOL>self._jobs, conn, dict(client=client, job_hash=jobHash), ['<STR_LIT>'])<EOL>assert row is not None<EOL>assert len(row) == <NUM_LIT:1>, '<STR_LIT>' + repr(len(row))<EOL>jobID = row[<NUM_LIT:0>]<EOL><DEDENT>if alreadyRunning:<EOL><INDENT>query = '<STR_LIT>''<STR_LIT>''<STR_LIT>''<STR_LIT>'% (self.jobsTableName,)<EOL>conn.cursor.execute(query, (self._connectionID, jobID))<EOL><DEDENT>return jobID<EOL>
Attempt to insert a row with the given parameters into the jobs table.
        Return jobID of the inserted row, or of an existing row with matching
        client/jobHash key.

        The combination of client and jobHash are expected to be unique (enforced
        by a unique index on the two columns).

        NOTE: It's possibe that this or another process (on this or another machine)
         already inserted a row with matching client/jobHash key (e.g.,
         StreamMgr). This may also happen undetected by this function due to a
         partially-successful insert operation (e.g., row inserted, but then
         connection was lost while reading response) followed by retries either of
         this function or in SteadyDB module.

        Parameters:
        ----------------------------------------------------------------
        conn:            Owned connection acquired from ConnectionFactory.get()
        client:          Name of the client submitting the job
        cmdLine:         Command line to use to launch each worker process; must be
                          a non-empty string
        jobHash:         unique hash of this job. The caller must insure that this,
                          together with client, uniquely identifies this job request
                          for the purposes of detecting duplicates.
        clientInfo:      JSON encoded dict of client specific information.
        clientKey:       Foreign key.
        params:          JSON encoded dict of the parameters for the job. This
                          can be fetched out of the database by the worker processes
                          based on the jobID.
        minimumWorkers:  minimum number of workers design at a time.
        maximumWorkers:  maximum number of workers desired at a time.
        priority:        Job scheduling priority; 0 is the default priority (
                          ClientJobsDAO.DEFAULT_JOB_PRIORITY); positive values are
                          higher priority (up to ClientJobsDAO.MAX_JOB_PRIORITY),
                          and negative values are lower priority (down to
                          ClientJobsDAO.MIN_JOB_PRIORITY). Higher-priority jobs will
                          be scheduled to run at the expense of the lower-priority
                          jobs, and higher-priority job tasks will preempt those
                          with lower priority if there is inadequate supply of
                          scheduling slots. Excess lower priority job tasks will
                          starve as long as slot demand exceeds supply. Most jobs
                          should be scheduled with DEFAULT_JOB_PRIORITY. System jobs
                          that must run at all cost, such as Multi-Model-Master,
                          should be scheduled with MAX_JOB_PRIORITY.
        alreadyRunning:  Used for unit test purposes only. This inserts the job
                          in the running state. It is used when running a worker
                          in standalone mode without hadoop- it gives it a job
                          record to work with.

        retval:           jobID of the inserted jobs row, or of an existing jobs row
                           with matching client/jobHash key