Skip to content

Commit

Permalink
attempting to enable/disable automated workflows after pipeline initi…
Browse files Browse the repository at this point in the history
…alization
  • Loading branch information
ksierks committed Oct 18, 2024
1 parent 4b6a918 commit 1463cd6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions config/initializers/pipelines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,18 @@
Rails.application.config.to_prepare do
Irida::Pipelines.instance = Irida::Pipelines.new if Irida::Pipelines.instance.nil?
end

Rails.application.config.after_initialize do
Irida::Pipelines.instance.available_pipelines.each_value do |pipeline|
next unless pipeline.automatable

automated_workflow = AutomatedWorkflowExecution.find_by(
"metadata ->> 'workflow_name' = ? and metadata ->> 'workflow_version' = ?", pipeline.name, pipeline.version
)

next unless automated_workflow

automated_workflow.disabled = pipeline.executable ? false : true
automated_workflow.save
end
end

0 comments on commit 1463cd6

Please sign in to comment.