#NEWLINE# def save_my_pid( cfg ) : #NEWLINE# #INDENT# mypid = os . getpid ( ) #NEWLINE# pid_path = cfg . dfa_log . pid_dir #NEWLINE# pid_file = cfg . dfa_log . pid_server_file #NEWLINE# if ( pid_path and pid_file ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( not os . path . exists ( pid_path ) ) : #NEWLINE# #INDENT# os . makedirs ( pid_path ) #NEWLINE# #UNINDENT# #UNINDENT# except OSError : #NEWLINE# #INDENT# LOG . error ( _LE ( 'Fail to create %s' ) , pid_path ) #NEWLINE# return #NEWLINE# #UNINDENT# pid_file_path = os . path . join ( pid_path , pid_file ) #NEWLINE# LOG . debug ( 'dfa_server pid=%s' , mypid ) #NEWLINE# with open ( pid_file_path , 'w' ) as funcp : #NEWLINE# #INDENT# funcp . write ( str ( mypid ) )