---
  handler: SelectiveFlowScheduling
  job_id: githubGatheringJob
  flow_name: bayesianFlow
  task_names:
    - github_details
    - ResultCollector
    - GraphImporterTask
  flow_arguments:
    - {
        "$filter": {
          "joins": [
            {
              "on": {
                "worker_results.analysis_id": "analyses.id"
              },
              "table": "analyses"
            },
            {
              "on": {
                "analyses.version_id": "versions.id"
              },
              "table": "versions"
            },
            {
              "on": {
                "versions.package_id": "packages.id"
              },
              "table": "packages"
            },
            {
              "on": {
                "ecosystems.id": "packages.ecosystem_id"
              },
              "table": "ecosystems"
            }
          ],
          "select": [
            "packages.name as name",
            "ecosystems.name as ecosystem",
            "versions.identifier as version"
          ],
          "limit": 10,
          "distinct": true,
          "where": {
            "worker_results.worker": "InitAnalysisFlow",
            "worker_results.error": false
          },
          "table": "worker_results"
        },
        "force": true
      }
  when:
  periodically: 5 minute
  # Keep this high so redeployment/downtime does not affect flow scheduling
  misfire_grace_time: 365 days
  state: running

---
  handler: SelectiveFlowScheduling
  job_id: githubGatheringJob
  flow_name: bayesianPackageFlow
  task_names:
    - github_details
    - PackageResultCollector
    - PackageGraphImporterTask
  flow_arguments:
    - {
        "force": true,
        "$filter": {
          "joins": [
            {
              "on": {
                "monitored_upstreams.package_id": "packages.id"
              },
              "table": "packages"
            },
            {
              "on": {
                "packages.ecosystem_id": "ecosystems.id"
              },
              "table": "ecosystems"
            }
          ],
          "select": [
            "packages.name as name",
            "ecosystems.name as ecosystem",
            "monitored_upstreams.url as url"
          ],
          "distinct": true,
          "where": {
            "monitored_upstreams.active": true,
            "monitored_upstreams.url is not": null
          },
          "table": "monitored_upstreams"
        }
      }
  when:
  periodically: 14 day
  # Keep this high so redeployment/downtime does not affect flow scheduling
  misfire_grace_time: 99999 days
  state: running

Use directly monitored_upstream tables for refreshing GitHub data
Use directly monitored_upstream tables for refreshing GitHub data
