Skip to content

Commit

Permalink
harvester | fix worker info page for postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
tkorchug committed Apr 19, 2023
1 parent a6d0f45 commit 70a4649
Showing 1 changed file with 36 additions and 31 deletions.
67 changes: 36 additions & 31 deletions core/harvester/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1488,37 +1488,42 @@ def getHarvesterJobs(request, instance='', workerid='', jobstatus='', fields='',
values.append(v)

sqlQuery = """
SELECT {2} FROM
(SELECT {2} FROM {DB_SCHEMA_PANDA}.JOBSARCHIVED4,
(select
pandaid as pid
from {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers where
{DB_SCHEMA_PANDA}.harvester_rel_jobs_workers.harvesterid {0} and {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers.workerid {1})
PIDACTIVE WHERE PIDACTIVE.pid={DB_SCHEMA_PANDA}.JOBSARCHIVED4.PANDAID {3}
UNION
SELECT {2} FROM {DB_SCHEMA_PANDA}.JOBSACTIVE4,
(select
pandaid as pid
from {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers where
{DB_SCHEMA_PANDA}.harvester_rel_jobs_workers.harvesterid {0} and {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers.workerid {1}) PIDACTIVE WHERE PIDACTIVE.pid={DB_SCHEMA_PANDA}.JOBSACTIVE4.PANDAID {3}
UNION
SELECT {2} FROM {DB_SCHEMA_PANDA}.JOBSDEFINED4,
(select
pandaid as pid
from {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers where
{DB_SCHEMA_PANDA}.harvester_rel_jobs_workers.harvesterid {0} and {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers.workerid {1}) PIDACTIVE WHERE PIDACTIVE.pid={DB_SCHEMA_PANDA}.JOBSDEFINED4.PANDAID {3}
UNION
SELECT {2} FROM {DB_SCHEMA_PANDA}.JOBSWAITING4,
(select
pandaid as pid
from {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers where
{DB_SCHEMA_PANDA}.harvester_rel_jobs_workers.harvesterid {0} and {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers.workerid {1}) PIDACTIVE WHERE PIDACTIVE.pid={DB_SCHEMA_PANDA}.JOBSWAITING4.PANDAID {3}
UNION
SELECT {2} FROM {DB_SCHEMA_PANDA_ARCH}.JOBSARCHIVED,
(select
pandaid as pid
from {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers where
{DB_SCHEMA_PANDA}.harvester_rel_jobs_workers.harvesterid {0} and {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers.workerid {1}) PIDACTIVE WHERE PIDACTIVE.pid={DB_SCHEMA_PANDA_ARCH}.JOBSARCHIVED.PANDAID {3})
select {2} from (
select {2} from {DB_SCHEMA_PANDA}.jobsarchived4 jarch4 , (
select pandaid as pid
from {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers
where harvesterid {0} and workerid {1}
) hj
where hj.pid=jarch4.pandaid {3}
union
select {2} from {DB_SCHEMA_PANDA}.jobsactive4 jact4, (
select pandaid as pid
from {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers
where harvesterid {0} and workerid {1}
) hj
where hj.pid=jact4.pandaid {3}
union
select {2} from {DB_SCHEMA_PANDA}.jobsdefined4 jd4, (
select pandaid as pid
from {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers
where harvesterid {0} and workerid {1}
) hj
where hj.pid=jd4.pandaid {3}
union
select {2} FROM {DB_SCHEMA_PANDA}.jobswaiting4 jw4, (
select pandaid as pid
from {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers
where harvesterid {0} and workerid {1}
) hj
where hj.pid=jw4.pandaid {3}
union
select {2} from {DB_SCHEMA_PANDA_ARCH}.jobsarchived ja, (
select pandaid as pid
from {DB_SCHEMA_PANDA}.harvester_rel_jobs_workers
where harvesterid {0} and workerid {1}
) hj
where hj.pid=ja.pandaid {3}
) comb_data
"""

sqlQuery = sqlQuery.format(
Expand Down

0 comments on commit 70a4649

Please sign in to comment.