Skip to content

Commit

Permalink
Merge pull request #4722 from galaxyproject/hyena-kelvin
Browse files Browse the repository at this point in the history
Add API for individual tools mapped to servers
  • Loading branch information
hexylena authored Feb 13, 2024
2 parents a06e767 + a71e0dc commit bc76b41
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _includes/instance-dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{% for inst in usegalaxy_exact %}
<li>
<a class="dropdown-item" href="{{ inst.url }}" title="{{ inst[0] }}">
{{ inst.name }} <abbr title="This instance supports the precise tool versions used in this tutorial"></abbr> ⭐️
{{ inst.name }} <abbr title="This instance supports the precise tool versions used in this tutorial"></abbr> <abbr title="This is a UseGalaxy.* server which meets minimum requirements for a public Galaxy">⭐️</abbr>
</a>
</li>
{% endfor %}
Expand Down
20 changes: 20 additions & 0 deletions _plugins/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,26 @@ def generate(site)
Jekyll::Hooks.register :site, :post_write do |site|
dir = File.join(site.dest, 'api', 'workflows')

# Public tool listing: reorganised
if site.data['public-server-tools'] and site.data['public-server-tools']['tools']
site.data['public-server-tools']['tools'].each do |tool, version_data|
path = File.join(site.dest, 'api', 'psl', "#{tool}.json")
dir = File.dirname(path)
FileUtils.mkdir_p(dir) unless File.directory?(dir)

d = version_data.dup
d.keys.each do |k|
# Replace the indexes with the server URLs from site['public-server-tools']['servers']
d[k] = d[k].map { |v| site.data['public-server-tools']['servers'][v] }
end

File.write(path, JSON.generate(d))
end
Jekyll.logger.debug "[GTN/API/PSL] PSL written"
else
Jekyll.logger.debug "[GTN/API/PSL] PSL Dataset not available, are you in a CI environment?"
end

# ro-crate-metadata.json
TopicFilter.list_all_materials(site).select { |m| m['workflows'] }.each do |material|
material['workflows'].each do |workflow|
Expand Down
99 changes: 99 additions & 0 deletions api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,58 @@
}
}
}
},
"/psl.json": {
"get": {
"tags": [
"tools"
],
"summary": "Get the GTN's public server tool listing. It lists all known public servers that are reachable at the time of the GTN's deployment, and which tool versions are installed on each of those servers.",
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Psl"
}
}
}
}
}
}
},
"/psl/{toolId}.json": {
"get": {
"tags": [
"tools"
],
"parameters": [
{
"name": "toolId",
"in": "path",
"example": "toolshed.g2.bx.psu.edu/repos/iuc/abricate/abricate",
"description": "Tool ID WITHOUT the version component!!",
"required": true,
"schema": {
"type": "string"
}
}
],
"summary": "Get the GTN's public server tool listing for a specific tool ID. It lists all known public servers that are reachable at the time of the GTN's deployment, and which versions of this tool are available. It's very important that you strip the version component!",
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PslIndividual"
}
}
}
}
}
}
}
},
"components": {
Expand Down Expand Up @@ -571,6 +623,53 @@
}
}
}
},
"Psl": {
"type": "object",
"properties": {
"servers": {
"$ref": "#/components/schemas/ArrayOfServers"
},
"tools": {
"$ref": "#/components/schemas/ArrayOfToolVersions"
}
}
},
"PslIndividual": {
"$ref": "#/components/schemas/ToolVersionClear"
},
"ArrayOfServers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Server"
}
},
"Server": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "A url for the server"
},
"name": {
"type": "string",
"description": "A human readable description"
}
}
},
"ArrayOfToolVersions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ToolVersionOpaque"
}
},
"ToolVersionOpaque": {
"type": "object",
"description": "A hash/dict where the top level keys are the known versions of that tool (or '_' for built in tools), and then the servers that have that tool. Note that the servers are actually a list of integers which refer to the Server listing field."
},
"ToolVersionClear": {
"type": "object",
"description": "A hash/dict where the top level keys are the known versions of that tool (or '_' for built in tools), and then the servers that have that tool."
}
}
}
Expand Down
66 changes: 66 additions & 0 deletions metadata/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,40 @@ paths:
200:
description: successful operation

/psl.json:
get:
tags:
- tools
summary: Get the GTN's public server tool listing. It lists all known public servers that are reachable at the time of the GTN's deployment, and which tool versions are installed on each of those servers.
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Psl'

/psl/{toolId}.json:
get:
tags:
- tools
parameters:
- name: toolId
in: path
example: toolshed.g2.bx.psu.edu/repos/iuc/abricate/abricate
description: Tool ID WITHOUT the version component!! Also when you call it properly you do NOT need to encode the /.
required: true
schema:
type: string
summary: Get the GTN's public server tool listing for a specific tool ID. It lists all known public servers that are reachable at the time of the GTN's deployment, and which versions of this tool are available. It's very important that you strip the version component!
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/PslIndividual'

components:
schemas:
TrainingMaterial:
Expand Down Expand Up @@ -389,3 +423,35 @@ components:
type: array
items:
$ref: '#/components/schemas/TrainingMaterial'
Psl:
type: object
properties:
servers:
$ref: '#/components/schemas/ArrayOfServers'
tools:
$ref: '#/components/schemas/ArrayOfToolVersions'
PslIndividual:
$ref: '#/components/schemas/ToolVersionClear'
ArrayOfServers:
type: array
items:
$ref: "#/components/schemas/Server"
Server:
type: object
properties:
url:
type: string
description: A url for the server
name:
type: string
description: A human readable description
ArrayOfToolVersions:
type: array
items:
$ref: "#/components/schemas/ToolVersionOpaque"
ToolVersionOpaque:
type: object
description: A hash/dict where the top level keys are the known versions of that tool (or '_' for built in tools), and then the servers that have that tool. Note that the servers are actually a list of integers which refer to the Server listing field.
ToolVersionClear:
type: object
description: A hash/dict where the top level keys are the known versions of that tool (or '_' for built in tools), and then the servers that have that tool.

0 comments on commit bc76b41

Please sign in to comment.