Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Commits
f0a95218
Commit
f0a95218
authored
4 years ago
by
Nathan Hertz
Browse files
Options
Downloads
Patches
Plain Diff
WorkflowInfo/CapabilityInfo: added methods to test persistence
parent
fdca1268
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shared/workspaces/src/workspaces/services.py
+19
-2
19 additions, 2 deletions
shared/workspaces/src/workspaces/services.py
with
19 additions
and
2 deletions
shared/workspaces/src/workspaces/services.py
+
19
−
2
View file @
f0a95218
"""
Services defined by the Workspaces system, to be used by our APIs and client programs.
"""
import
shutil
import
stat
import
threading
import
subprocess
...
...
@@ -294,6 +293,19 @@ class CapabilityInfo(CapabilityInfoIF):
.
one
()
)
def
requests_for_capability
(
self
,
capability_name
:
str
)
->
List
[
CapabilityRequest
]:
"""
Gets all capability requests for a given capability
:param capability_name: Name of capability
:return: List of associated requests
"""
capability
=
self
.
lookup_capability
(
capability_name
)
return
(
self
.
session
.
query
(
CapabilityRequest
)
.
filter_by
(
capability_id
=
capability
.
id
)
.
all
()
)
class
CapabilityEngine
(
CapabilityEngineIF
):
"""
...
...
@@ -486,7 +498,9 @@ class WorkflowService(WorkflowServiceIF):
log_file
=
self
.
_execute_prepared
(
temp_folder
)
# 6. start reading log file
monitor
=
WorkflowMonitor
(
logfile_path
=
(
log_file
),
workflow_request_id
=
request
.
workflow_request_id
)
monitor
=
WorkflowMonitor
(
logfile_path
=
(
log_file
),
workflow_request_id
=
request
.
workflow_request_id
)
# parse events from log
events
=
monitor
.
events
with
workflow_events
:
...
...
@@ -609,6 +623,9 @@ class WorkflowInfo(WorkflowInfoIF):
def
all_workflows
(
self
)
->
List
[
Workflow
]:
return
self
.
session
.
query
(
Workflow
).
all
()
def
all_workflow_requests
(
self
)
->
List
[
WorkflowRequest
]:
return
self
.
session
.
query
(
WorkflowRequest
).
all
()
def
create_workflow_request
(
self
,
workflow
:
Workflow
,
argument
:
Dict
)
->
WorkflowRequest
:
...
...
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