Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
521c55dd
Commit
521c55dd
authored
Aug 19, 2020
by
Alvin Noe Ladines
Browse files
Changed query_model
parent
507ad087
Pipeline
#80697
passed with stages
in 30 minutes and 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/app/api/common.py
View file @
521c55dd
...
...
@@ -88,36 +88,28 @@ query_model_fields.update(**{
'until_time'
:
fields
.
Raw
(
description
=
'The maximum entry time.'
,
allow_null
=
True
,
skip_none
=
True
)
})
query_model
=
api
.
model
(
'Query0'
,
query_model_fields
)
for
n
in
range
(
1
,
3
):
query_model
=
api
.
model
(
'Query%d'
%
n
,
{
**
query_model_fields
,
**
{
'$and'
:
fields
.
List
(
fields
.
Nested
(
query_model
,
allow_null
=
True
,
skip_none
=
True
),
description
=
(
'List of queries which must be present in search results.'
)),
'$or'
:
fields
.
List
(
fields
.
Nested
(
query_model
,
allow_null
=
True
,
skip_none
=
True
,
description
=
(
'List of queries which should be present in search results.'
))),
'$not'
:
fields
.
List
(
fields
.
Nested
(
query_model
,
allow_null
=
True
,
skip_none
=
True
,
description
=
(
'List of queries which must not be present in search results.'
))),
'$lt'
:
fields
.
Nested
(
api
.
model
(
'Querylt'
,
query_model_fields
),
allow_null
=
True
,
skip_none
=
True
,
description
=
(
'Dict of quantiy name: value such that search results should have values '
'less than value.'
)),
'$lte'
:
fields
.
Nested
(
api
.
model
(
'Querylte'
,
query_model_fields
),
allow_null
=
True
,
skip_none
=
True
,
description
=
(
'Dict of quantiy name: value such that search results should have values '
'less than or equal to value'
)),
'$gt'
:
fields
.
Nested
(
api
.
model
(
'Querygt'
,
query_model_fields
),
allow_null
=
True
,
skip_none
=
True
,
description
=
(
'Dict of quantiy name: value such that search results should have values '
'greater than value'
)),
'$gte'
:
fields
.
Nested
(
api
.
model
(
'Querygte'
,
query_model_fields
),
allow_null
=
True
,
skip_none
=
True
,
description
=
(
'Dict of quantiy name: value such that search results should have values '
'greater than or equal to value'
)),
}})
query_model_fields
.
update
(
**
{
'$and'
:
fields
.
List
(
fields
.
Raw
,
description
=
(
'List of queries which must be present in search results.'
)),
'$or'
:
fields
.
List
(
fields
.
Raw
,
description
=
(
'List of queries which should be present in search results.'
)),
'$not'
:
fields
.
List
(
fields
.
Raw
,
description
=
(
'List of queries which must not be present in search results.'
)),
'$lt'
:
fields
.
Raw
(
description
=
(
'Dict of quantiy name: value such that search results should have values '
'less than value.'
)),
'$lte'
:
fields
.
Raw
(
description
=
(
'Dict of quantiy name: value such that search results should have values '
'less than or equal to value'
)),
'$gt'
:
fields
.
Raw
(
description
=
(
'Dict of quantiy name: value such that search results should have values '
'greater than value'
)),
'$gte'
:
fields
.
Raw
(
description
=
(
'Dict of quantiy name: value such that search results should have values '
'greater than or equal to value'
)),
})
query_model
=
api
.
model
(
'Query'
,
query_model_fields
)
search_model_fields
=
{
'query'
:
fields
.
Nested
(
query_model
,
allow_null
=
True
,
skip_none
=
True
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment