forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
78 changed files
with
5,039 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
MINDMAPS := $(wildcard *.mindmap.yml) | ||
INPUTS := $(wildcard *.plantuml.txt) | ||
OUTPUTS := $(INPUTS:.txt=.svg) | ||
|
||
all: plantuml.jar $(MINDMAPS) $(OUTPUTS) | ||
|
||
$(OUTPUTS): $(INPUTS) $(MINDMAPS) | ||
java -jar plantuml.jar -c plantuml_options.txt -tsvg $(INPUTS) | ||
|
||
plantuml.jar: | ||
wget http://jaist.dl.sourceforge.net/project/plantuml/plantuml.jar || curl --output plantuml.jar http://jaist.dl.sourceforge.net/project/plantuml/plantuml.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
' skinparam handwritten true | ||
' skinparam roundcorner 20 | ||
|
||
skinparam class { | ||
ArrowFontColor DarkOrange | ||
BackgroundColor #FFEFD5 | ||
ArrowColor Orange | ||
BorderColor DarkOrange | ||
} | ||
|
||
skinparam object { | ||
ArrowFontColor DarkOrange | ||
BackgroundColor #FFEFD5 | ||
BackgroundColor #FFEFD5 | ||
ArrowColor Orange | ||
BorderColor DarkOrange | ||
} | ||
|
||
skinparam ComponentBackgroundColor #FFEFD5 | ||
skinparam ComponentBorderColor DarkOrange | ||
|
||
skinparam DatabaseBackgroundColor #FFEFD5 | ||
skinparam DatabaseBorderColor DarkOrange | ||
|
||
skinparam StorageBackgroundColor #FFEFD5 | ||
skinparam StorageBorderColor DarkOrange | ||
|
||
skinparam QueueBackgroundColor #FFEFD5 | ||
skinparam QueueBorderColor DarkOrange | ||
|
||
skinparam note { | ||
BackgroundColor #FFEFD5 | ||
BorderColor #BF5700 | ||
} | ||
|
||
skinparam sequence { | ||
ArrowColor Orange | ||
ArrowFontColor DarkOrange | ||
ActorBorderColor DarkOrange | ||
ActorBackgroundColor #FFEFD5 | ||
|
||
ParticipantBorderColor DarkOrange | ||
ParticipantBackgroundColor #FFEFD5 | ||
|
||
LifeLineBorderColor DarkOrange | ||
LifeLineBackgroundColor #FFEFD5 | ||
|
||
DividerBorderColor DarkOrange | ||
GroupBorderColor DarkOrange | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<style> | ||
mindmapDiagram { | ||
node { | ||
BackgroundColor #FFEFD5 | ||
BorderColor DarkOrange | ||
LineColor Orange | ||
} | ||
} | ||
</style> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@startuml | ||
'!include plantuml_options.txt | ||
participant "API Request" as apireq | ||
boundary "Jobs API" as api | ||
participant "Job Service" as service | ||
database Database as database | ||
queue TaskQueue as queue | ||
apireq -> api : HTTP JSON | ||
api -> service : To boundary | ||
service -> service : Build RequestToolState | ||
service -> service : Validate RequestToolState (pydantic) | ||
service -> service : decode() RequestToolState \ninto RequestInternalToolState | ||
service -> database : Serialize RequestInternalToolState | ||
service -> queue : Queue QueueJobs with reference to\npersisted RequestInternalToolState | ||
service -> api : JobCreateResponse\n (pydantic model) | ||
api -> apireq : JobCreateResponse\n (as json) | ||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@startuml | ||
!include plantuml_options.txt | ||
|
||
package galaxy.tool_util.parameters.state { | ||
|
||
class ToolState { | ||
state_representation: str | ||
input_state: Dict[str, Any] | ||
+ validate(input_models: ToolParameterBundle) | ||
+ {abstract} _to_base_model(input_models: ToolParameterBundle): Optional[Type[BaseModel]] | ||
} | ||
|
||
class RequestToolState { | ||
state_representation = "request" | ||
+ _to_base_model(input_models: ToolParameterBundle): Type[BaseModel] | ||
} | ||
note bottom: Object references of the form \n{src: "hda", id: <encoded_id>}.\n Allow mapping/reduce constructs. | ||
|
||
class RequestInternalToolState { | ||
state_representation = "request_internal" | ||
+ _to_base_model(input_models: ToolParameterBundle): Type[BaseModel] | ||
} | ||
note bottom: Object references of the form \n{src: "hda", id: <decoded_id>}.\n Allow mapping/reduce constructs. | ||
|
||
class JobInternalToolState { | ||
state_representation = "job_internal" | ||
+ _to_base_model(input_models: ToolParameterBundle): Type[BaseModel] | ||
|
||
} | ||
note bottom: Object references of the form \n{src: "hda", id: <decoded_id>}.\n Mapping constructs expanded out.\n (Defaults are inserted?) | ||
|
||
ToolState <|-- RequestToolState | ||
ToolState <|-- RequestInternalToolState | ||
ToolState <|-- JobInternalToolState | ||
|
||
RequestToolState - RequestInternalToolState : decode > | ||
|
||
RequestInternalToolState o-- JobInternalToolState : expand > | ||
|
||
} | ||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
from .convert import ( | ||
decode, | ||
encode, | ||
) | ||
from .factory import ( | ||
from_input_source, | ||
input_models_for_pages, | ||
input_models_for_tool_source, | ||
input_models_from_json, | ||
tool_parameter_bundle_from_json, | ||
) | ||
from .json import to_json_schema_string | ||
from .models import ( | ||
BooleanParameterModel, | ||
ColorParameterModel, | ||
ConditionalParameterModel, | ||
ConditionalWhen, | ||
CwlBooleanParameterModel, | ||
CwlDirectoryParameterModel, | ||
CwlFileParameterModel, | ||
CwlFloatParameterModel, | ||
CwlIntegerParameterModel, | ||
CwlNullParameterModel, | ||
CwlStringParameterModel, | ||
CwlUnionParameterModel, | ||
DataCollectionParameterModel, | ||
DataParameterModel, | ||
FloatParameterModel, | ||
HiddenParameterModel, | ||
IntegerParameterModel, | ||
LabelValue, | ||
RepeatParameterModel, | ||
RulesParameterModel, | ||
SelectParameterModel, | ||
TextParameterModel, | ||
ToolParameterBundle, | ||
ToolParameterBundleModel, | ||
ToolParameterModel, | ||
ToolParameterT, | ||
validate_against_model, | ||
validate_internal_request, | ||
validate_request, | ||
validate_test_case, | ||
) | ||
from .state import ( | ||
JobInternalToolState, | ||
RequestInternalToolState, | ||
RequestToolState, | ||
TestCaseToolState, | ||
ToolState, | ||
) | ||
from .visitor import visit_input_values | ||
|
||
__all__ = ( | ||
"from_input_source", | ||
"input_models_for_pages", | ||
"input_models_for_tool_source", | ||
"tool_parameter_bundle_from_json", | ||
"input_models_from_json", | ||
"JobInternalToolState", | ||
"ToolParameterBundle", | ||
"ToolParameterBundleModel", | ||
"ToolParameterModel", | ||
"IntegerParameterModel", | ||
"BooleanParameterModel", | ||
"CwlFileParameterModel", | ||
"CwlFloatParameterModel", | ||
"CwlIntegerParameterModel", | ||
"CwlStringParameterModel", | ||
"CwlNullParameterModel", | ||
"CwlUnionParameterModel", | ||
"CwlBooleanParameterModel", | ||
"CwlDirectoryParameterModel", | ||
"TextParameterModel", | ||
"FloatParameterModel", | ||
"HiddenParameterModel", | ||
"ColorParameterModel", | ||
"RulesParameterModel", | ||
"DataParameterModel", | ||
"DataCollectionParameterModel", | ||
"LabelValue", | ||
"SelectParameterModel", | ||
"ConditionalParameterModel", | ||
"ConditionalWhen", | ||
"RepeatParameterModel", | ||
"validate_against_model", | ||
"validate_internal_request", | ||
"validate_request", | ||
"validate_test_case", | ||
"ToolState", | ||
"TestCaseToolState", | ||
"ToolParameterT", | ||
"to_json_schema_string", | ||
"RequestToolState", | ||
"RequestInternalToolState", | ||
"visit_input_values", | ||
"decode", | ||
"encode", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
"""Type utilities for building pydantic models for tool parameters. | ||
Lots of mypy exceptions in here - this code is all well tested and the exceptions | ||
are fine otherwise because we're using the typing system to interact with pydantic | ||
and build runtime models not to use mypy to type check static code. | ||
""" | ||
|
||
from typing import ( | ||
Any, | ||
cast, | ||
Generic, | ||
List, | ||
Optional, | ||
Type, | ||
Union, | ||
) | ||
|
||
# https://stackoverflow.com/questions/56832881/check-if-a-field-is-typing-optional | ||
# Python >= 3.8 | ||
try: | ||
from typing import get_args # type: ignore[attr-defined,unused-ignore] | ||
from typing import get_origin # type: ignore[attr-defined,unused-ignore] | ||
# Compatibility | ||
except ImportError: | ||
|
||
def get_args(tp: Any) -> tuple: | ||
return getattr(tp, "__args__", ()) if tp is not Generic else Generic # type: ignore[return-value,assignment,unused-ignore] | ||
|
||
def get_origin(tp: Any) -> Optional[Any]: # type: ignore[no-redef,unused-ignore] | ||
return getattr(tp, "__origin__", None) | ||
|
||
|
||
def optional_if_needed(type: Type, is_optional: bool) -> Type: | ||
return_type: Type = type | ||
if is_optional: | ||
return_type = Optional[type] # type: ignore[assignment] | ||
return return_type | ||
|
||
|
||
def union_type(args: List[Type]) -> Type: | ||
return Union[tuple(args)] # type: ignore[return-value] | ||
|
||
|
||
def list_type(arg: Type) -> Type: | ||
return List[arg] # type: ignore[valid-type] | ||
|
||
|
||
def cast_as_type(arg) -> Type: | ||
return cast(Type, arg) | ||
|
||
|
||
def is_optional(field) -> bool: | ||
return get_origin(field) is Union and type(None) in get_args(field) |
Oops, something went wrong.