From 1331fea82bb6d6a1d57baa366ad7057176fbc2b9 Mon Sep 17 00:00:00 2001 From: athith-g <66563785+athith-g@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:38:33 -0400 Subject: [PATCH] feat: update TES models to v1.1 (#179) * feat: add ignore_error to TesExecutor * feat: add backend_parameters and backend_parameters_strict to TesResources * feat: add new tesStates * refactor: make TesFileType optional * feat: add streamable to TesInput * refactor: avoid string literal * fix: shorten doc line lengths * fix: change example to examples --------- Co-authored-by: Alex Kanitz --- pro_tes/ga4gh/tes/models.py | 57 +++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/pro_tes/ga4gh/tes/models.py b/pro_tes/ga4gh/tes/models.py index 2f0b039..a9bdb2c 100644 --- a/pro_tes/ga4gh/tes/models.py +++ b/pro_tes/ga4gh/tes/models.py @@ -111,6 +111,15 @@ class TesExecutor(CustomBaseModel): ), examples=[{"BLASTDB": "/data/GRC38", "HMMERDB": "/data/hmmer"}], ) + ignore_error: Optional[bool] = Field( + default=None, + description=( + "Default behavior of running an array of executors is that " + "execution stopson the first error. If `ignore_error` is `True`, " + "then the runner will record error exit codes, but will continue " + "on to the next tesExecutor." + ), + ) class TesExecutorLog(CustomBaseModel): @@ -181,7 +190,7 @@ class TesInput(CustomBaseModel): ), examples=["/data/file1"], ) - type: TesFileType + type: Optional[TesFileType] = TesFileType.FILE content: Optional[str] = Field( default=None, description=( @@ -191,6 +200,20 @@ class TesInput(CustomBaseModel): ' "url" must be ignored.' ), ) + streamable: Optional[bool] = Field( + default=None, + description=( + "Indicate that a file resource could be accessed using a" + " streaming interface, ie a FUSE mounted s3 object. This flag" + " indicates that using a streaming mount, as opposed to " + "downloading the whole file to the local scratch space, may be " + "faster despite the latency and overhead. This does not mean that" + " the backend will use a streaming interface, as it may not be " + "provided by the vendor, but if the capacity is avalible it can " + " be used without degrading the performance of the underlying" + " program." + ), + ) class TesOutput(CustomBaseModel): @@ -220,7 +243,7 @@ class TesOutput(CustomBaseModel): " absolute path." ), ) - type: TesFileType + type: Optional[TesFileType] = TesFileType.FILE class TesOutputFileLog(CustomBaseModel): @@ -284,6 +307,34 @@ class TesResources(CustomBaseModel): ), examples=["us-west-1"], ) + backend_parameters: Optional[dict[str, str]] = Field( + default=None, + description=( + "Key/value pairs for backend configuration.ServiceInfo shall " + "return a list of keys that a backend supports. Keys are case " + "insensitive. It is expected that clients pass all runtime or " + "hardware requirement key/values that are not mapped to existing" + " tesResources properties to backend_parameters. Backends shall" + " log system warnings if a key is passed that is unsupported. " + "Backends shall not store or return unsupported keys if included " + "in a task. If backend_parameters_strict equals true, backends " + "should fail the task if any key/values are unsupported, " + " otherwise, backends should attempt to run the task Intended " + "uses include VM size selection, coprocessor configuration," + ' etc. \nExample: ```\n{\n "backend_parameters" : {\n ' + '"VmSize" :"Standard_D64_v3"\n }\n}\n```' + ), + examples=[{"VmSize": "Standard_D64_v3"}], + ) + backend_parameters_strict: Optional[bool] = Field( + default=False, + description=( + "If set to true, backends should fail the task if any" + " backend_parameters key/values are unsupported, otherwise, " + "backends should attempt to run the task" + ), + examples=[False], + ) class Artifact(Enum): @@ -434,6 +485,8 @@ class TesState(Enum): EXECUTOR_ERROR = "EXECUTOR_ERROR" SYSTEM_ERROR = "SYSTEM_ERROR" CANCELED = "CANCELED" + PREEMPTED = "PREEMPTED" + CANCELING = "CANCELING" class TesNextTes(CustomBaseModel):