Exemplo n.º 1
0
        public static int RunJobs(
            JobType jobType,
            JobScope jobScope,
            IEnumerable <string> jobNames,
            JobConfiguration configuration = null,
            bool debug = false
            )
        {
            configuration = configuration ?? JobConstants.DefaultJobConfiguration;
            JobConfiguration.DumpConfiguration(configuration, JobConstants.JobConfigFile);
            Console.WriteLine($"Running jobs with config: {configuration.ToString()}");
            var jobsList = CreateJobList(jobType, jobScope, jobNames, configuration);

            if (jobsList.Any())
            {
                var jobs  = RunJobsCommand.BuildJobsDict(jobsList);
                var tasks = RunJobsCommand.ScheduleJobs(jobs, debug);
                return(RunJobsCommand.WaitAll(tasks));
            }
            else
            {
                Console.WriteLine("Couldn't find any valid credential or No job was selected!");
                return(1);
            }
        }
Exemplo n.º 2
0
        public static int RunInstagramJobs(JobType jobType, JobScope jobScope, JobConfiguration configuration = null, bool debug = false)
        {
            jobScope = JobScope.All;
            var instagramJobNames = new List <string>();

            foreach (var id in Jobs.Fetcher.Facebook.SchemaLoader.GetInstagramId())
            {
                instagramJobNames.Add($"Jobs.Fetcher.Facebook.instagram.{id}");
                instagramJobNames.Add($"Jobs.Fetcher.Facebook.instagram.media.{id}");
            }
            return(RunJobsCommand.RunJobs(jobType, jobScope, instagramJobNames, configuration, debug));
        }
Exemplo n.º 3
0
        public static List <ReportRow> GetReportData(DateTime startDate)
        {
            var DLConnectionString = GetDatabaseConnectionStrings();

            var jobsList = RunJobsCommand.CreateJobList(JobType.All, JobScope.All, new List <string>(), JobConstants.DefaultJobConfiguration);
            var DLJobs   = jobsList.Select(x => x.Id()).Where(x => x.Contains("Jobs.Fetcher")).ToList();

            var dlLogEntries = GetLogs("logging", startDate, DLConnectionString, DLJobs);

            dlLogEntries.ForEach(x => {
                (x.FirstName, x.SurName) = RuntimeLog.ParseLogName(x.FullName, '.', 3);
            });
            return(dlLogEntries);
        }