Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pkm-python-client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
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
Decoder
pkm-python-client
Commits
1ddff100
Commit
1ddff100
authored
3 years ago
by
Gaël de Chalendar
Browse files
Options
Downloads
Patches
Plain Diff
Correct pkm access errors handling
parent
d38a658b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pkm_python_client.egg-info/PKG-INFO
+1
-1
1 addition, 1 deletion
pkm_python_client.egg-info/PKG-INFO
pkm_python_client/pkm_client.py
+12
-2
12 additions, 2 deletions
pkm_python_client/pkm_client.py
pyproject.toml
+1
-1
1 addition, 1 deletion
pyproject.toml
with
14 additions
and
4 deletions
pkm_python_client.egg-info/PKG-INFO
+
1
−
1
View file @
1ddff100
Metadata-Version: 1.0
Name: pkm-python-client
Version: 0.1.
5
Version: 0.1.
7
Summary: A python client for the Decoder project's PKM server
Home-page: UNKNOWN
Author: Gaël de Chalendar
...
...
This diff is collapsed.
Click to expand it.
pkm_python_client/pkm_client.py
+
12
−
2
View file @
1ddff100
...
...
@@ -3,6 +3,7 @@ import os
import
requests
import
sys
from
datetime
import
datetime
from
typing
import
Dict
# # TODO should not ignore this warning. Remove when the pkm certificate will
# # be corrected
...
...
@@ -101,7 +102,10 @@ class PKMClient(object):
def
now
(
self
):
return
datetime
.
now
().
strftime
(
"
%Y%m%d_%H%M%S
"
)
def
update_invocation
(
self
,
project_id
,
invocationId
,
status
,
resultsToAdd
):
def
update_invocation
(
self
,
project_id
:
str
,
invocationId
:
str
,
status
:
int
,
resultsToAdd
:
Dict
[
str
,
str
]):
"""
"""
invocationUpdate
=
dict
()
invocationUpdate
[
"
invocationID
"
]
=
invocationId
...
...
@@ -130,7 +134,7 @@ class Log(object):
def
__init__
(
self
,
pkm
:
PKMClient
,
project
:
str
,
tool
:
str
,
status
:
str
=
""
,
details
:
dict
=
{},
nature
:
str
=
"
Execution report
"
,
max_msg_len
=
80
):
max_msg_len
=
80
,
invocation_id
=
None
):
self
.
pkm
=
pkm
self
.
project
=
project
# tool name/tag
...
...
@@ -150,6 +154,7 @@ class Log(object):
self
.
errors
=
[]
self
.
status
=
True
self
.
details
=
{}
self
.
invocation_id
=
invocation_id
def
__del__
(
self
):
status
,
result
=
self
.
pkm
.
call
(
method
=
'
POST
'
,
...
...
@@ -158,6 +163,11 @@ class Log(object):
if
status
!=
0
:
print
(
f
"
Logging
{
self
.
json
()
}
failed with
{
status
}
:
{
result
}
"
,
file
=
sys
.
stderr
)
elif
self
.
invocation_id
is
not
None
:
newLogID
=
json
.
loads
(
result
)[
0
]
self
.
pkm
.
update_invocation
(
self
.
project
,
self
.
invocation_id
,
status
,
dict
(
path
=
f
"
log/
{
self
.
project
}
"
+
str
(
newLogID
),
type
=
"
log
"
))
def
_log_to
(
self
,
msg
:
str
,
dest
:
list
):
dest
.
append
(
msg
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
1
View file @
1ddff100
[tool.poetry]
name
=
"pkm-python-client"
version
=
"0.1.
4
"
version
=
"0.1.
7
"
description
=
"A python client for the Decoder project's PKM server"
authors
=
[
"Gaël de Chalendar <gael.de-chalendar@cea.fr>"
]
...
...
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