@logExceptions(_LOGGER)<EOL><INDENT>@g_retrySQL<EOL>def modelSetCompleted(self, modelID, completionReason, completionMsg,<EOL>cpuTime=<NUM_LIT:0>, useConnectionID=True):<DEDENT>
if completionMsg is None:<EOL><INDENT>completionMsg = '<STR_LIT>'<EOL><DEDENT>query = '<STR_LIT>''<STR_LIT>''<STR_LIT>''<STR_LIT>''<STR_LIT>''<STR_LIT>''<STR_LIT>''<STR_LIT>'% (self.modelsTableName,)<EOL>sqlParams = [self.STATUS_COMPLETED, completionReason, completionMsg,<EOL>cpuTime, modelID]<EOL>if useConnectionID:<EOL><INDENT>query += "<STR_LIT>"<EOL>sqlParams.append(self._connectionID)<EOL><DEDENT>with ConnectionFactory.get() as conn:<EOL><INDENT>numRowsAffected = conn.cursor.execute(query, sqlParams)<EOL><DEDENT>if numRowsAffected != <NUM_LIT:1>:<EOL><INDENT>raise InvalidConnectionException(<EOL>("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>") % (modelID, self._connectionID, numRowsAffected))<EOL><DEDENT>
Mark a model as completed, with the given completionReason and
        completionMsg. This will fail if the model does not currently belong to this
        client (connection_id doesn't match).

        Parameters:
        ----------------------------------------------------------------
        modelID:             model ID of model to modify
        completionReason:    completionReason string
        completionMsg:       completionMsg string
        cpuTime:             amount of CPU time spent on this model
        useConnectionID:     True if the connection id of the calling function
                              must be the same as the connection that created the
                              job. Set to True for hypersearch workers, which use
                              this mechanism for orphaned model detection.