Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API for individual tools mapped to servers #4722

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading