Skip to content

Commit

Permalink
Merge pull request #5686 from galaxyproject/wf-fetch-fix
Browse files Browse the repository at this point in the history
Fix deploy
  • Loading branch information
shiltemann authored Jan 13, 2025
2 parents 4701c12 + b9dfda3 commit c6cc03a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions bin/workflows-fetch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def request(url)
request['Accept'] = 'application/json'
req_options = {
use_ssl: uri.scheme == 'https',
max_retries: 5,
}
Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
Expand All @@ -37,19 +38,32 @@ def fetch_workflows(server)
end

def fetch_workflowhub
projects = JSON.parse(request('https://workflowhub.eu/projects').body)

begin
projects = JSON.parse(request('https://workflowhub.eu/projects').body)

response = request('https://workflowhub.eu/workflows?filter[workflow_type]=galaxy')
data = JSON.parse(response.body)
rescue StandardError
puts "ERROR: cannot fetch from WorkflowHub"
return []
end

project_mapping = projects['data'].to_h { |p| [p['id'], p['attributes']['title']] }

response = request('https://workflowhub.eu/workflows?filter[workflow_type]=galaxy')
data = JSON.parse(response.body)
if !data['links']['next'].nil?
puts 'ERROR: Cannot yet handle multiple pages'
exit 42
end
puts "INFO: Fetching #{data['data'].length} workflows from WorkflowHub"
data['data'].map.with_index do |w, _i|
# {"id"=>"14", "type"=>"workflows", "attributes"=>{"title"=>"Cheminformatics - Docking"}, "links"=>{"self"=>"/workflows/14"}}
wf_info = JSON.parse(request("https://workflowhub.eu#{w['links']['self']}").body)
begin
wf_info = JSON.parse(request("https://workflowhub.eu#{w['links']['self']}").body)
rescue StandardError
puts "ERROR: cannont fetch from WorkflowHub"
return []
end
creator_list = []

creator0 = wf_info['data']['attributes']['creators'][0]
Expand Down

0 comments on commit c6cc03a

Please sign in to comment.