def gen_jid(opts=None):
    '''
    Generate a jid
    '''
    if opts is None:
        salt.utils.versions.warn_until(
            'Sodium',
            'The `opts` argument was not passed into salt.utils.jid.gen_jid(). '
            'This will be required starting in {version}.'
        )
        opts = {}
    global LAST_JID_DATETIME  # pylint: disable=global-statement

    if opts.get('utc_jid', False):
        jid_dt = datetime.datetime.utcnow()
    else:
        jid_dt = datetime.datetime.now()
    if not opts.get('unique_jid', False):
        return '{0:%Y%m%d%H%M%S%f}'.format(jid_dt)
    if LAST_JID_DATETIME and LAST_JID_DATETIME >= jid_dt:
        jid_dt = LAST_JID_DATETIME + datetime.timedelta(microseconds=1)
    LAST_JID_DATETIME = jid_dt
    return '{0:%Y%m%d%H%M%S%f}_{1}'.format(jid_dt, os.getpid())
def gen_jid ( opts = None ) : if opts is None : salt . utils . versions . warn_until ( 'Sodium' , 'The `opts` argument was not passed into salt.utils.jid.gen_jid(). ' 'This will be required starting in {version}.' ) opts = { } global LAST_JID_DATETIME if opts . get ( 'utc_jid' , False ) : jid_dt = datetime . datetime . utcnow ( ) else : jid_dt = datetime . datetime . now ( ) if not opts . get ( 'unique_jid' , False ) : return '{0:%Y%m%d%H%M%S%f}' . format ( jid_dt ) if LAST_JID_DATETIME and LAST_JID_DATETIME >= jid_dt : jid_dt = LAST_JID_DATETIME + datetime . timedelta ( microseconds = 1 ) LAST_JID_DATETIME = jid_dt return '{0:%Y%m%d%H%M%S%f}_{1}' . format ( jid_dt , os . getpid ( ) )
Generate a jid