Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
bdd5021d
Verified
Commit
bdd5021d
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
remove Tuple import
parent
f4df5ebf
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!81
Feature/remove typing import
Pipeline
#84204
passed
1 year ago
Stage: tox
Stage: documentation
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/workflows/__init__.py
+8
-8
8 additions, 8 deletions
test/workflows/__init__.py
with
8 additions
and
8 deletions
test/workflows/__init__.py
+
8
−
8
View file @
bdd5021d
...
...
@@ -2,7 +2,7 @@ import difflib
import
pprint
from
copy
import
deepcopy
from
itertools
import
chain
,
repeat
from
typing
import
Callable
,
Tuple
,
cast
from
typing
import
Callable
,
cast
from
uuid
import
uuid4
import
structlog
...
...
@@ -143,7 +143,7 @@ class WorkflowInstanceForTests(LazyWorkflowInstance):
return
f
"
WorkflowInstanceForTests(
'
{
self
.
workflow
}
'
,
'
{
self
.
name
}
'
)
"
def
_store_step
(
step_log
:
list
[
T
uple
[
Step
,
WFProcess
]])
->
Callable
[[
ProcessStat
,
Step
,
WFProcess
],
WFProcess
]:
def
_store_step
(
step_log
:
list
[
t
uple
[
Step
,
WFProcess
]])
->
Callable
[[
ProcessStat
,
Step
,
WFProcess
],
WFProcess
]:
def
__store_step
(
pstat
:
ProcessStat
,
step
:
Step
,
state
:
WFProcess
)
->
WFProcess
:
try
:
state
=
state
.
map
(
lambda
s
:
json_loads
(
json_dumps
(
s
)))
...
...
@@ -164,14 +164,14 @@ def _sanitize_input(input_data: State | list[State]) -> list[State]:
return
cast
(
list
[
State
],
json_loads
(
json_dumps
(
input_data
)))
def
run_workflow
(
workflow_key
:
str
,
input_data
:
State
|
list
[
State
])
->
T
uple
[
WFProcess
,
ProcessStat
,
list
]:
def
run_workflow
(
workflow_key
:
str
,
input_data
:
State
|
list
[
State
])
->
t
uple
[
WFProcess
,
ProcessStat
,
list
]:
# ATTENTION!! This code needs to be as similar as possible to `server.services.processes.start_process`
# The main differences are: we use a different step log function and we don't run in
# a sepperate thread
user_data
=
_sanitize_input
(
input_data
)
user
=
"
john.doe
"
step_log
:
list
[
T
uple
[
Step
,
WFProcess
]]
=
[]
step_log
:
list
[
t
uple
[
Step
,
WFProcess
]]
=
[]
process_id
=
uuid4
()
workflow
=
get_workflow
(
workflow_key
)
...
...
@@ -201,8 +201,8 @@ def run_workflow(workflow_key: str, input_data: State | list[State]) -> Tuple[WF
def
resume_workflow
(
process
:
ProcessStat
,
step_log
:
list
[
T
uple
[
Step
,
WFProcess
]],
input_data
:
State
)
->
T
uple
[
WFProcess
,
list
]:
process
:
ProcessStat
,
step_log
:
list
[
t
uple
[
Step
,
WFProcess
]],
input_data
:
State
)
->
t
uple
[
WFProcess
,
list
]:
# ATTENTION!! This code needs to be as similar as possible to `server.services.processes.resume_process`
# The main differences are: we use a different step log function, and we don't run in a separate thread
user_data
=
_sanitize_input
(
input_data
)
...
...
@@ -229,7 +229,7 @@ def resume_workflow(
def
run_form_generator
(
form_generator
:
FormGenerator
,
extra_inputs
:
list
[
State
]
|
None
=
None
)
->
T
uple
[
list
[
dict
],
State
]:
)
->
t
uple
[
list
[
dict
],
State
]:
"""
Run a form generator to get the resulting forms and result.
Warning! This does not run the actual pydantic validation on purpose. However, you should
...
...
@@ -245,7 +245,7 @@ def run_form_generator(
Returns:
-------
T
uple[list[dict], State]: A list of generated forms and the result state for the whole generator.
t
uple[list[dict], State]: A list of generated forms and the result state for the whole generator.
Example:
-------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment