Skip to content

How get result of previous task in chain? #345

Closed Answered by ukolovda
ukolovda asked this question in Q&A
Discussion options

You must be logged in to vote

Made second task for single-running job:

      PERFORM timetable.add_task(
        kind => 'SQL',
        parent_id => v_mail_task_id,
        command => format(
$query$WITH
log(result, output) as (select
    case when returncode = 0 then 1 else 0 end,
    output
  from timetable.execution_log 
  where task_id=%s 
  order by last_run desc 
  limit 1),
insert_log(id) AS (INSERT INTO LOG_SEND_MAIL(
          SENDER, RECIPIENT, MESSAGE_TITLE, MAIL_TEXT, SENT_RESULT, ERROR_MESSAGE)
  select  %L,     %L,        %L,            %L,        log.result,  log.output
  from log
  returning SEND_MAIL_WITH_ATTACHMENT_ID)
select timetable.delete_job(%L)
  $query$,
      v_mail_task_id,
      MAIL.USER_L…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@pashagolub
Comment options

@ukolovda
Comment options

Answer selected by pashagolub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants