pegasus-analyzer return non-zero exit code if workflow contains failed jobs.
Add correct option switches for use with state-update script
Add job-level notifications to gte job status at lower granularity
Remove job name argument. Populate it through PEGASUS_JOBID environment variable
Strings must be quoted in SQL.
Check for status if run status is not 256 i.e. Stopped.
For pegasus analyzer ignore exit-code 2 as it indicates failed jobs in workflow and not a failure in analyzer.
Remove print statement
If workflow is stopped we set status = 256 in the runs table.

However, When a workflow is removed, the workflow at_end notification will set job_status as failed, thus the notification will override the stopped status.

Add a condition so monitord notification does not override the workflow stopped status (only for at_end event)