Skip to content

Commit d76c0c6

Browse files
committed
Input parameter schema.
1 parent 71e0e7d commit d76c0c6

File tree

80 files changed

+5181
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+5181
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ doc/build
153153
doc/schema.md
154154
doc/source/admin/config_logging_default_yaml.rst
155155
doc/source/dev/schema.md
156+
doc/source/dev/plantuml.jar
156157
client/docs/dist
157158

158159
# Webpack stats

doc/source/dev/image.Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
MINDMAPS := $(wildcard *.mindmap.yml)
2+
INPUTS := $(wildcard *.plantuml.txt)
3+
OUTPUTS := $(INPUTS:.txt=.svg)
4+
5+
all: plantuml.jar $(MINDMAPS) $(OUTPUTS)
6+
7+
$(OUTPUTS): $(INPUTS) $(MINDMAPS)
8+
java -jar plantuml.jar -c plantuml_options.txt -tsvg $(INPUTS)
9+
10+
plantuml.jar:
11+
wget http://jaist.dl.sourceforge.net/project/plantuml/plantuml.jar || curl --output plantuml.jar http://jaist.dl.sourceforge.net/project/plantuml/plantuml.jar
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
' skinparam handwritten true
2+
' skinparam roundcorner 20
3+
4+
skinparam class {
5+
ArrowFontColor DarkOrange
6+
BackgroundColor #FFEFD5
7+
ArrowColor Orange
8+
BorderColor DarkOrange
9+
}
10+
11+
skinparam object {
12+
ArrowFontColor DarkOrange
13+
BackgroundColor #FFEFD5
14+
BackgroundColor #FFEFD5
15+
ArrowColor Orange
16+
BorderColor DarkOrange
17+
}
18+
19+
skinparam ComponentBackgroundColor #FFEFD5
20+
skinparam ComponentBorderColor DarkOrange
21+
22+
skinparam DatabaseBackgroundColor #FFEFD5
23+
skinparam DatabaseBorderColor DarkOrange
24+
25+
skinparam StorageBackgroundColor #FFEFD5
26+
skinparam StorageBorderColor DarkOrange
27+
28+
skinparam QueueBackgroundColor #FFEFD5
29+
skinparam QueueBorderColor DarkOrange
30+
31+
skinparam note {
32+
BackgroundColor #FFEFD5
33+
BorderColor #BF5700
34+
}
35+
36+
skinparam sequence {
37+
ArrowColor Orange
38+
ArrowFontColor DarkOrange
39+
ActorBorderColor DarkOrange
40+
ActorBackgroundColor #FFEFD5
41+
42+
ParticipantBorderColor DarkOrange
43+
ParticipantBackgroundColor #FFEFD5
44+
45+
LifeLineBorderColor DarkOrange
46+
LifeLineBackgroundColor #FFEFD5
47+
48+
DividerBorderColor DarkOrange
49+
GroupBorderColor DarkOrange
50+
}
51+

doc/source/dev/plantuml_style.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<style>
2+
mindmapDiagram {
3+
node {
4+
BackgroundColor #FFEFD5
5+
BorderColor DarkOrange
6+
LineColor Orange
7+
}
8+
}
9+
</style>

doc/source/dev/tool_state.md

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@startuml
2+
'!include plantuml_options.txt
3+
participant "API Request" as apireq
4+
boundary "Jobs API" as api
5+
participant "Job Service" as service
6+
database Database as database
7+
queue TaskQueue as queue
8+
apireq -> api : HTTP JSON
9+
api -> service : To boundary
10+
service -> service : Build RequestToolState
11+
service -> service : Validate RequestToolState (pydantic)
12+
service -> service : decode() RequestToolState \ninto RequestInternalToolState
13+
service -> database : Serialize RequestInternalToolState
14+
service -> queue : Queue QueueJobs with reference to\npersisted RequestInternalToolState
15+
service -> api : JobCreateResponse\n (pydantic model)
16+
api -> apireq : JobCreateResponse\n (as json)
17+
@enduml
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@startuml
2+
!include plantuml_options.txt
3+
4+
package galaxy.tool_util.parameters.state {
5+
6+
class ToolState {
7+
state_representation: str
8+
input_state: Dict[str, Any]
9+
+ validate(input_models: ToolParameterBundle)
10+
+ {abstract} _to_base_model(input_models: ToolParameterBundle): Optional[Type[BaseModel]]
11+
}
12+
13+
class RequestToolState {
14+
state_representation = "request"
15+
+ _to_base_model(input_models: ToolParameterBundle): Type[BaseModel]
16+
}
17+
note bottom: Object references of the form \n{src: "hda", id: <encoded_id>}.\n Allow mapping/reduce constructs.
18+
19+
class RequestInternalToolState {
20+
state_representation = "request_internal"
21+
+ _to_base_model(input_models: ToolParameterBundle): Type[BaseModel]
22+
}
23+
note bottom: Object references of the form \n{src: "hda", id: <decoded_id>}.\n Allow mapping/reduce constructs.
24+
25+
class JobInternalToolState {
26+
state_representation = "job_internal"
27+
+ _to_base_model(input_models: ToolParameterBundle): Type[BaseModel]
28+
29+
}
30+
note bottom: Object references of the form \n{src: "hda", id: <decoded_id>}.\n Mapping constructs expanded out.\n (Defaults are inserted?)
31+
32+
ToolState <|-- RequestToolState
33+
ToolState <|-- RequestInternalToolState
34+
ToolState <|-- JobInternalToolState
35+
36+
RequestToolState - RequestInternalToolState : decode >
37+
38+
RequestInternalToolState o-- JobInternalToolState : expand >
39+
40+
}
41+
@enduml

lib/galaxy/config/schemas/tool_shed_config_schema.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ mapping:
102102
the repositories and tools within the Tool Shed given that you specify
103103
the following two config options.
104104
105+
tool_state_cache_dir:
106+
type: str
107+
default: database/tool_state_cache
108+
required: false
109+
desc: |
110+
Cache directory for tool state.
111+
105112
repo_name_boost:
106113
type: float
107114
default: 0.9

lib/galaxy/tool_util/cwl/parser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ def galaxy_id(self) -> str:
144144
tool_id = tool_id[1:]
145145
return tool_id
146146

147+
@abstractmethod
148+
def input_fields(self) -> list:
149+
"""Return InputInstance objects describing mapping to Galaxy inputs."""
150+
147151
@abstractmethod
148152
def input_instances(self):
149153
"""Return InputInstance objects describing mapping to Galaxy inputs."""
@@ -236,7 +240,7 @@ def label(self):
236240
else:
237241
return ""
238242

239-
def input_fields(self):
243+
def input_fields(self) -> list:
240244
input_records_schema = self._eval_schema(self._tool.inputs_record_schema)
241245
if input_records_schema["type"] != "record":
242246
raise Exception("Unhandled CWL tool input structure")
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
from .convert import (
2+
decode,
3+
encode,
4+
)
5+
from .factory import (
6+
from_input_source,
7+
input_models_for_pages,
8+
input_models_for_tool_source,
9+
input_models_from_json,
10+
tool_parameter_bundle_from_json,
11+
)
12+
from .json import to_json_schema_string
13+
from .models import (
14+
BooleanParameterModel,
15+
ColorParameterModel,
16+
ConditionalParameterModel,
17+
ConditionalWhen,
18+
CwlBooleanParameterModel,
19+
CwlDirectoryParameterModel,
20+
CwlFileParameterModel,
21+
CwlFloatParameterModel,
22+
CwlIntegerParameterModel,
23+
CwlNullParameterModel,
24+
CwlStringParameterModel,
25+
CwlUnionParameterModel,
26+
DataCollectionParameterModel,
27+
DataParameterModel,
28+
FloatParameterModel,
29+
HiddenParameterModel,
30+
IntegerParameterModel,
31+
LabelValue,
32+
RepeatParameterModel,
33+
RulesParameterModel,
34+
SelectParameterModel,
35+
TextParameterModel,
36+
ToolParameterBundle,
37+
ToolParameterBundleModel,
38+
ToolParameterModel,
39+
ToolParameterT,
40+
validate_against_model,
41+
validate_internal_job,
42+
validate_internal_request,
43+
validate_request,
44+
validate_test_case,
45+
)
46+
from .state import (
47+
JobInternalToolState,
48+
RequestInternalToolState,
49+
RequestToolState,
50+
TestCaseToolState,
51+
ToolState,
52+
)
53+
from .visitor import visit_input_values
54+
55+
__all__ = (
56+
"from_input_source",
57+
"input_models_for_pages",
58+
"input_models_for_tool_source",
59+
"tool_parameter_bundle_from_json",
60+
"input_models_from_json",
61+
"JobInternalToolState",
62+
"ToolParameterBundle",
63+
"ToolParameterBundleModel",
64+
"ToolParameterModel",
65+
"IntegerParameterModel",
66+
"BooleanParameterModel",
67+
"CwlFileParameterModel",
68+
"CwlFloatParameterModel",
69+
"CwlIntegerParameterModel",
70+
"CwlStringParameterModel",
71+
"CwlNullParameterModel",
72+
"CwlUnionParameterModel",
73+
"CwlBooleanParameterModel",
74+
"CwlDirectoryParameterModel",
75+
"TextParameterModel",
76+
"FloatParameterModel",
77+
"HiddenParameterModel",
78+
"ColorParameterModel",
79+
"RulesParameterModel",
80+
"DataParameterModel",
81+
"DataCollectionParameterModel",
82+
"LabelValue",
83+
"SelectParameterModel",
84+
"ConditionalParameterModel",
85+
"ConditionalWhen",
86+
"RepeatParameterModel",
87+
"validate_against_model",
88+
"validate_internal_job",
89+
"validate_internal_request",
90+
"validate_request",
91+
"validate_test_case",
92+
"ToolState",
93+
"TestCaseToolState",
94+
"ToolParameterT",
95+
"to_json_schema_string",
96+
"RequestToolState",
97+
"RequestInternalToolState",
98+
"visit_input_values",
99+
"decode",
100+
"encode",
101+
)

0 commit comments

Comments
 (0)