Skip to content
Snippets Groups Projects
make_jobs.sql 925 B

-- SQL to add jobs to the InterCal processing DB for all AIRS
-- granules up through the current day. this should be run daily to
-- keep the jobs table current

insert into intercal_jobs
    select '2003-01-01'::date + s1.i, s2.i, 'held'
        from generate_series(0, current_date - '2003-01-01') as s1(i),
             generate_series(0, 23) as s2(i)
        where s1.i > coalesce((select max(airs_date) - '2003-01-01'
                                   from intercal_jobs),
                              -1);

insert into grouper_jobs
    select '2003-01-01'::date + s1.i, s2.i, 1, 'idle'
        from generate_series(0, current_date - '2003-01-01') as s1(i),
             generate_series(0, 23) as s2(i)
        where s1.i > coalesce((select max(airs_date) - '2003-01-01'
                                   from grouper_jobs
                                   where grouper_id = 1),
                              -1);