Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Autocnet
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Autocnet
Commits
2a7f67a5
Commit
2a7f67a5
authored
3 years ago
by
Gavin
Browse files
Options
Downloads
Patches
Plain Diff
removed whitespace and addressed feedback from pr
parent
2f60fc51
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
autocnet/graph/cluster_submit.py
+1
-2
1 addition, 2 deletions
autocnet/graph/cluster_submit.py
autocnet/graph/tests/test_cluster_submit.py
+15
-4
15 additions, 4 deletions
autocnet/graph/tests/test_cluster_submit.py
with
16 additions
and
6 deletions
autocnet/graph/cluster_submit.py
+
1
−
2
View file @
2a7f67a5
...
...
@@ -20,7 +20,6 @@ from autocnet.utils.utils import import_func
from
autocnet.utils.serializers
import
JsonEncoder
,
object_hook
from
autocnet.io.db.model
import
JobsHistory
# set up the logging file
log
=
logging
.
getLogger
(
__name__
)
def
parse_args
():
# pragma: no cover
...
...
@@ -231,7 +230,7 @@ def manage_messages(args, queue):
def
main
():
# pragma: no cover
args
=
vars
(
parse_args
())
# set up the logger
logging
.
basicConfig
(
level
=
os
.
environ
.
get
(
"
autocnet_loglevel
"
,
"
INFO
"
))
logging
.
basicConfig
(
level
=
os
.
environ
.
get
(
"
AUTOCNET_LOGLEVEL
"
,
"
INFO
"
))
# Get the message
queue
=
StrictRedis
(
host
=
args
[
'
host
'
],
port
=
args
[
'
port
'
],
db
=
0
)
manage_messages
(
args
,
queue
)
...
...
This diff is collapsed.
Click to expand it.
autocnet/graph/tests/test_cluster_submit.py
+
15
−
4
View file @
2a7f67a5
...
...
@@ -172,9 +172,21 @@ def test_process_row(along, func, msg_additions, mocker):
cluster_submit
.
_instantiate_row
.
assert_called_once
()
@pytest.mark.parametrize
()
def
_do_something
():
log
.
debug
(
"
Doing something!
"
)
log
.
info
(
"
This is some info
"
)
def
_do_something
(
log_level
):
return
getattr
(
log
,
log_level
)(
f
'
Logging at the
{
log_level
}
'
)
def
test_do_something
(
caplog
):
log_levels
=
[
"
critical
"
,
"
error
"
,
"
warning
"
,
"
info
"
,
"
debug
"
]
for
level
in
log_levels
:
os
.
environ
[
"
AUTOCNET_LOGLEVEL
"
]
=
level
_do_something
(
os
.
environ
[
"
AUTOCNET_LOGLEVEL
"
])
for
record
in
caplog
.
records
:
# casting the env var and record level to a string for comparison
assert
(
str
(
os
.
environ
[
"
AUTOCNET_LOGLEVEL
"
]).
upper
()
==
str
(
record
.
levelname
).
upper
())
caplog
.
clear
()
@pytest.mark.parametrize
(
"
along, func, msg_additions
"
,[
([
1
,
2
,
3
,
4
,
5
],
_do_nothing
,
{})
...
...
@@ -190,7 +202,6 @@ def test_process_generic(along, func, msg_additions, mocker):
mocker
.
patch
(
'
autocnet.graph.cluster_submit._instantiate_obj
'
,
side_effect
=
_generate_obj
)
mocker
.
patch
(
'
autocnet.graph.network.NetworkCandidateGraph.Session
'
,
return_value
=
True
)
mocker
.
patch
(
'
autocnet.graph.network.NetworkCandidateGraph.config_from_dict
'
)
_do_something
()
assert
not
cluster_submit
.
_instantiate_row
.
called
assert
not
cluster_submit
.
_instantiate_obj
.
called
...
...
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