Sha256: 976e2b99887dba7d2509908bd7d3858a527a9d60572024a8610f8f7178bfdc17

Contents?: true

Size: 1.43 KB

Versions: 23

Compression:

Stored size: 1.43 KB

Contents

module Logical
  module Naf
    module JobStatuses
      class Waiting

        def self.all(conditions)
          <<-SQL
            (
              SELECT DISTINCT
                j.*, jp."historical_job_id"
              FROM
                "#{::Naf.schema_name}"."historical_jobs" AS j
              LEFT JOIN
                "#{::Naf.schema_name}"."historical_job_prerequisites" AS jp
                ON j."id" = jp."historical_job_id"
              WHERE
                j.finished_at is NULL AND
                j.request_to_terminate = false AND
                jp.historical_job_id IS NOT NULL
                AND j.started_at is NULL AND
                EXISTS (
                  SELECT
                    1
                  FROM
                    "#{::Naf.schema_name}"."historical_jobs"
                  JOIN
                    "#{::Naf.schema_name}"."historical_job_prerequisites" ON
                    "#{::Naf.schema_name}"."historical_jobs"."id" = "#{::Naf.schema_name}"."historical_job_prerequisites"."prerequisite_historical_job_id"
                  WHERE
                    "#{::Naf.schema_name}"."historical_job_prerequisites"."historical_job_id" = jp."historical_job_id" AND
                    "#{::Naf.schema_name}"."historical_jobs"."finished_at" is NULL
                )
                #{conditions}
                ORDER BY
                  created_at DESC
              )
          SQL
        end

      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
naf-2.1.13 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.12 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.11 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.10 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.9 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.8 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.6 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.5 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.4 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.3 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.2 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.1 app/models/logical/naf/job_statuses/waiting.rb
naf-2.1.0 app/models/logical/naf/job_statuses/waiting.rb
naf-2.0.4 app/models/logical/naf/job_statuses/waiting.rb
naf-2.0.3 app/models/logical/naf/job_statuses/waiting.rb
naf-2.0.2 app/models/logical/naf/job_statuses/waiting.rb
naf-2.0.1 app/models/logical/naf/job_statuses/waiting.rb
naf-2.0.0 app/models/logical/naf/job_statuses/waiting.rb
naf-1.1.4 app/models/logical/naf/job_statuses/waiting.rb
naf-1.1.3 app/models/logical/naf/job_statuses/waiting.rb