<commit_before>package club.magicfun.aquila.job;

import java.util.Date;
import java.util.List;
import java.util.Set;

import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import club.magicfun.aquila.model.Job;
import club.magicfun.aquila.model.Rank;
import club.magicfun.aquila.model.RankSearchQueue;
import club.magicfun.aquila.model.RankSearchType;
import club.magicfun.aquila.service.RankingService;
import club.magicfun.aquila.service.ScheduleService;
import club.magicfun.aquila.util.HtmlUtility;
import club.magicfun.aquila.util.StringUtility;

@Component
public class RankSearchJob {

	private static final Logger logger = LoggerFactory.getLogger(RankSearchJob.class);

	private static final String RANK_SEARCH_URL_TEMPLATE = "http://s.taobao.com/search?q={KEYWORD}&sort={SORTTYPE}&style=list";

	@Autowired
	private ScheduleService scheduleService;

	@Autowired
	private RankingService rankingService;

	public RankSearchJob() {
		super();
	}

	@Scheduled(cron = "0/30 * * * * ? ")
	public void run() {

		String className = this.getClass().getName();
		Job job = scheduleService.findJobByClassName(className);

		// determine if to run this job
		if (job != null && job.isJobReadyToRun()) {

			job = scheduleService.startJob(job);
			logger.info("Job [" + job.getId() + "," + job.getClassName() + "] is started.");

			List<RankSearchQueue> rankSearchQueues = rankingService.findAllRankSearchQueues();

			if (rankSearchQueues != null) {
				logger.info("Rank Search Queues count = " + rankSearchQueues.size());<commit_msg>code changes<commit_after>package club.magicfun.aquila.job;

import java.util.Date;
import java.util.List;
import java.util.Set;

import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import club.magicfun.aquila.model.Job;
import club.magicfun.aquila.model.Rank;
import club.magicfun.aquila.model.RankSearchQueue;
import club.magicfun.aquila.model.RankSearchType;
import club.magicfun.aquila.service.RankingService;
import club.magicfun.aquila.service.ScheduleService;
import club.magicfun.aquila.util.HtmlUtility;
import club.magicfun.aquila.util.StringUtility;

@Component
public class RankSearchJob {

	private static final Logger logger = LoggerFactory.getLogger(RankSearchJob.class);

	private static final String RANK_SEARCH_URL_TEMPLATE = "http://s.taobao.com/search?q={KEYWORD}&sort={SORTTYPE}&style=list";

	private static final int RANK_SEARCH_QUEUE_NUMBER_PER_TIME = 5;
	
	@Autowired
	private ScheduleService scheduleService;

	@Autowired
	private RankingService rankingService;

	public RankSearchJob() {
		super();
	}

	@Scheduled(cron = "0/30 * * * * ? ")
	public void run() {

		String className = this.getClass().getName();
		Job job = scheduleService.findJobByClassName(className);

		// determine if to run this job
		if (job != null && job.isJobReadyToRun()) {

			job = scheduleService.startJob(job);
			logger.info("Job [" + job.getId() + "," + job.getClassName() + "] is started.");

			List<RankSearchQueue> rankSearchQueues = rankingService.findFewActivePendingRankSearchQueues(RANK_SEARCH_QUEUE_NUMBER_PER_TIME);

			if (rankSearchQueues != null && rankSearchQueues.size() > 0) {
				logger.info("Rank Search Queues count = " + rankSearchQueues.size());
{'fraction_non_alphanumeric': 0.1171148529781352, 'fraction_numerical': 0.0030158331239004774, 'mean_word_length': 5.7116357504215856, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '2139554', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1252, 'n_words': 228}