Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine
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
Container Registry
Model registry
Operate
Environments
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
AURA
engine
Commits
b21cce83
Verified
Commit
b21cce83
authored
9 months ago
by
Chris Pastl
Committed by
Ole Binder
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
chore: fetch virtual timeslots, add optional get params
parent
a25206c9
No related branches found
No related tags found
1 merge request
!46
Steering playout schema and virtual timeslot integration
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/aura_engine/base/api.py
+6
-4
6 additions, 4 deletions
src/aura_engine/base/api.py
src/aura_engine/scheduling/api.py
+1
-1
1 addition, 1 deletion
src/aura_engine/scheduling/api.py
with
7 additions
and
5 deletions
src/aura_engine/base/api.py
+
6
−
4
View file @
b21cce83
...
@@ -204,7 +204,9 @@ class SimpleRestApi:
...
@@ -204,7 +204,9 @@ class SimpleRestApi:
return
json_data
return
json_data
@exception_handler
@exception_handler
def
get
(
self
,
url
:
str
,
headers
:
dict
=
None
,
timeout
:
int
=
5
)
->
requests
.
Response
:
def
get
(
self
,
url
:
str
,
headers
:
dict
=
None
,
params
:
dict
=
None
,
timeout
:
int
=
5
)
->
requests
.
Response
:
"""
"""
GET from an URL.
GET from an URL.
...
@@ -222,7 +224,7 @@ class SimpleRestApi:
...
@@ -222,7 +224,7 @@ class SimpleRestApi:
json_data
=
None
json_data
=
None
if
not
headers
:
if
not
headers
:
headers
=
SimpleRestApi
.
default_headers
headers
=
SimpleRestApi
.
default_headers
response
=
requests
.
get
(
url
,
headers
=
headers
,
timeout
=
timeout
)
response
=
requests
.
get
(
url
,
headers
=
headers
,
params
=
params
,
timeout
=
timeout
)
if
headers
.
get
(
"
content-type
"
)
==
SimpleRestApi
.
CONTENT_JSON
:
if
headers
.
get
(
"
content-type
"
)
==
SimpleRestApi
.
CONTENT_JSON
:
json_data
=
self
.
deserialize_json
(
response
)
json_data
=
self
.
deserialize_json
(
response
)
return
DotDict
({
"
response
"
:
response
,
"
json
"
:
json_data
})
return
DotDict
({
"
response
"
:
response
,
"
json
"
:
json_data
})
...
@@ -305,7 +307,7 @@ class SimpleCachedRestApi:
...
@@ -305,7 +307,7 @@ class SimpleCachedRestApi:
self
.
cache_location
=
cache_location
self
.
cache_location
=
cache_location
self
.
logger
=
logging
.
getLogger
(
logger_name
)
self
.
logger
=
logging
.
getLogger
(
logger_name
)
def
get
(
self
,
url
:
str
,
headers
:
dict
=
None
)
->
requests
.
Response
:
def
get
(
self
,
url
:
str
,
headers
:
dict
=
None
,
params
:
dict
=
None
)
->
requests
.
Response
:
"""
"""
GET from an URL while also storing the result in the local cache.
GET from an URL while also storing the result in the local cache.
...
@@ -322,7 +324,7 @@ class SimpleCachedRestApi:
...
@@ -322,7 +324,7 @@ class SimpleCachedRestApi:
"""
"""
filename
=
self
.
build_filename
(
url
)
filename
=
self
.
build_filename
(
url
)
cache_filepath
=
self
.
cache_location
+
filename
cache_filepath
=
self
.
cache_location
+
filename
result
=
self
.
simple_api
.
get
(
url
,
headers
)
result
=
self
.
simple_api
.
get
(
url
,
headers
,
params
)
if
result
and
result
.
json
and
result
.
response
.
status_code
==
200
:
if
result
and
result
.
json
and
result
.
response
.
status_code
==
200
:
with
open
(
cache_filepath
,
"
w
"
)
as
file
:
with
open
(
cache_filepath
,
"
w
"
)
as
file
:
...
...
This diff is collapsed.
Click to expand it.
src/aura_engine/scheduling/api.py
+
1
−
1
View file @
b21cce83
...
@@ -160,7 +160,7 @@ class ApiFetcher(threading.Thread):
...
@@ -160,7 +160,7 @@ class ApiFetcher(threading.Thread):
api_timeslots
=
None
api_timeslots
=
None
url
=
self
.
url_api_timeslots
url
=
self
.
url_api_timeslots
self
.
logger
.
debug
(
"
Fetch timeslots from Steering API...
"
)
self
.
logger
.
debug
(
"
Fetch timeslots from Steering API...
"
)
result
=
self
.
api
.
get
(
url
)
result
=
self
.
api
.
get
(
url
,
params
=
{
"
includeVirtual
"
:
"
true
"
}
)
api_timeslots
=
result
.
json
api_timeslots
=
result
.
json
if
not
api_timeslots
:
if
not
api_timeslots
:
return
return
...
...
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