<commit_before>namespace :sisyphus do
  desc 'Import all bugs to database'
  task bugs: :environment do
    puts "#{ Time.now }: import bugs"
    if Redis.current.get('__SYNC__')
      exist = begin
                Process.kill(0, Redis.current.get('__SYNC__').to_i)
                true
              rescue
                false
              end
      if exist
        puts "#{ Time.now }: update is locked by another cron script"
        Process.exit!(true)
      else
        puts "#{ Time.now }: dead lock found and deleted"
        Redis.current.del('__SYNC__')
      end
    end
    Redis.current.set('__SYNC__', Process.pid)
    url = 'https://bugzilla.altlinux.org/buglist.cgi?ctype=csv'
    BugsImport.new(url).execute
    puts "#{ Time.now }: end"
    Redis.current.del('__SYNC__')
  end
end<commit_msg>Update bugs import task<commit_after>namespace :sisyphus do
  desc 'Import all bugs to database'
  task bugs: :environment do
    Rails.logger.info("#{ Time.zone.now }: import bugs")
    if Redis.current.get('__SYNC__')
      exist = begin
                Process.kill(0, Redis.current.get('__SYNC__').to_i)
                true
              rescue
                false
              end
      if exist
        Rails.logger.info("#{ Time.zone.now }: update is locked by another cron script")
        Process.exit!(true)
      else
        Rails.logger.info("#{ Time.zone.now }: dead lock found and deleted")
        Redis.current.del('__SYNC__')
      end
    end
    Redis.current.set('__SYNC__', Process.pid)
    url = 'https://bugzilla.altlinux.org/buglist.cgi?ctype=csv'
    BugsImport.new(url).execute
    Rails.logger.info("#{ Time.zone.now }: end")
    Redis.current.del('__SYNC__')
  end
end
{'fraction_non_alphanumeric': 0.12121212121212122, 'fraction_numerical': 0.0011655011655011655, 'mean_word_length': 2.15625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2442210', 'n_tokens_mistral': 546, 'n_tokens_neox': 547, 'n_words': 124}