Skip to content

Commit e8d1922

Browse files
BrunoCoimbramambelli
authored andcommitted
Fix docstrings errors and warnings
1 parent fc6aefd commit e8d1922

10 files changed

Lines changed: 95 additions & 67 deletions

File tree

doc/source/release_notes/release_notes_1.6.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Enhancements:
2222

2323

2424
Full list of commits since version 1.6.1
25-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2626

2727
`c4c7681 <https://github.com/HEPCloud/decisionengine/commit/c4c7681ccb391acdca1da79a972f2cbf8b31b87a>`_: Updated de-query-tool w/ cherry pick of fixes from latest version of PR#332
2828

doc/source/release_notes/release_notes_1.7.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Patch level (bug fix) release.
1818

1919

2020
Issues fixed in this release
21-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2222

2323

2424
Bugs fixed
@@ -31,7 +31,7 @@ Enhancements:
3131

3232

3333
Full list of commits since version 1.7.0
34-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3535

3636
`606e1e9f <https://github.com/HEPCloud/decisionengine/commit/606e1e9fdd56b17e51fef92da679bfbb90485747>`_: Merge pull request #585 from vitodb/fix/1.7/vito_port_PR527
3737

doc/source/release_notes/release_notes_2.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Patch level (bug fix) release.
88

99

1010
Issues fixed in this release
11-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
11+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1212

1313
Bugs fixed
1414

@@ -26,7 +26,7 @@ Enhancements:
2626

2727

2828
Full list of commits since version 2.0.0
29-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3030

3131
`b5e56ab8 <https://github.com/HEPCloud/decisionengine/commit/b5e56ab8701266e890fed6e9ca4baff49c131c86>`_: Remove signal handler.
3232

src/decisionengine/framework/dataspace/datablock.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,18 +278,25 @@ def store_taskmanager(self, taskmanager_name, taskmanager_id):
278278
def get_taskmanager(self, taskmanager_name, taskmanager_id=None):
279279
"""
280280
Retrieve TaskManager
281-
:type taskmanager_name: :obj:`string`
282-
:arg taskmanager_name: name of taskmanager to retrieve
283-
:type taskmanager_id: :obj:`string`
284-
:arg taskmanager_id: id of taskmanager to retrieve
285-
:rtype: :obj: `dict`
281+
282+
Args:
283+
taskmanager_name (str): Name of the TaskManager
284+
taskmanager_id (str, optional): ID of the TaskManager to retrieve. Defaults to None.
285+
286+
Returns:
287+
dict: TaskManager information
286288
287289
The dictionary returned looks like :
288-
{'datestamp': datetime.datetime(2017, 12, 20, 17, 37, 17, 503210,
289-
tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=-360, name=None)),
290-
'sequence_id': 135L,
291-
'name': 'AWS_Calculations',
292-
'taskmanager_id': '77B16EB5-C79E-45B0-B1B1-37E846692E1D'}
290+
291+
.. code-block:: python
292+
293+
{
294+
'datestamp': datetime.datetime(2017, 12, 20, 17, 37, 17, 503210,
295+
tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=-360, name=None)),
296+
'sequence_id': 135L,
297+
'name': 'AWS_Calculations',
298+
'taskmanager_id': '77B16EB5-C79E-45B0-B1B1-37E846692E1D'
299+
}
293300
"""
294301
return self.dataspace.get_taskmanager(taskmanager_name, taskmanager_id)
295302

src/decisionengine/framework/dataspace/datasources/sqlalchemy_ds/datasource_api.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,24 @@ class SQLAlchemyDS(ds.DataSource):
3232
"""
3333
A DecisionEngine data source via the SQL Alchemy ORM
3434
35-
{
36-
"dataspace": {
37-
"datasource": {
38-
"module": "decisionengine.framework.dataspace.datasources.sqlalchemy_ds",
39-
"name": "SQLAlchemyDS",
40-
"params": {
41-
"pool_size": 5,
42-
"max_overflow": 10,
43-
"timeout": 30,
44-
45-
# url is mandatory, but any `engine` keyword is accepted here.
46-
"url": "dialect[+driver]://user:password@host/dbname"
47-
}
35+
.. code-block:: python
36+
37+
{
38+
"dataspace": {
39+
"datasource": {
40+
"module": "decisionengine.framework.dataspace.datasources.sqlalchemy_ds",
41+
"name": "SQLAlchemyDS",
42+
"params": {
43+
"pool_size": 5,
44+
"max_overflow": 10,
45+
"timeout": 30,
46+
47+
# url is mandatory, but any `engine` keyword is accepted here.
48+
"url": "dialect[+driver]://user:password@host/dbname"
49+
}
50+
}
51+
}
4852
}
49-
}
50-
}
5153
5254
Exceptions should be caught and logged by the caller.
5355
"""

src/decisionengine/framework/logicengine/FactLookup.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,28 @@ class FactLookup:
2020
2121
As an example, consider the following configuration:
2222
23-
facts: {
24-
should_publish: "(True)",
25-
},
26-
rules: {
27-
publish_1: {
28-
expression: "should_publish",
29-
facts: ["should_publish"]
30-
},
31-
publish_2: {
32-
expression: "should_publish",
33-
actions: ["go_to_press"]
34-
facts: ["should_publish"]
23+
.. code-block:: json
24+
25+
{
26+
"facts": {
27+
"should_publish": "(True)"
28+
},
29+
"rules": {
30+
"publish_1": {
31+
"expression": "should_publish",
32+
"facts": ["should_publish"]
33+
},
34+
"publish_2": {
35+
"expression": "should_publish",
36+
"actions": ["go_to_press"],
37+
"facts": ["should_publish"]
38+
},
39+
"retract": {
40+
"expression": "not should_publish",
41+
"facts": ["should_retract"]
42+
}
43+
}
3544
}
36-
retract: {
37-
expression: "not should_publish",
38-
facts: ["should_retract"]
39-
}
4045
4146
In the above, the first fact to be evaluated will always be the
4247
top-level facts (i.e. those not encapsulated by the 'rules' table).

src/decisionengine/framework/logicengine/LogicEngine.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,20 @@ def _create_facts_dataframe(self, newfacts):
9191
['rule_name', 'fact_name', fact_value']
9292
9393
facts dict format:
94-
'newfacts': {
95-
'publish_glidein_requests': {
96-
'allow_hpc_new': True,
97-
'allow_foo': True
98-
},
99-
'dummy_rule': {
100-
'dummy_new_fact': True
94+
95+
.. code-block:: json
96+
97+
{
98+
"newfacts": {
99+
"publish_glidein_requests": {
100+
"allow_hpc_new": true,
101+
"allow_foo": true
102+
},
103+
"dummy_rule": {
104+
"dummy_new_fact": true
105+
}
106+
}
101107
}
102-
}
103108
"""
104109
self.logger.debug("in LE::_create_facts_dataframe")
105110
# Extract new facts from le_result

src/decisionengine/framework/taskmanager/LatestMessages.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
1212
The LatestMessages class is intended to be used as a context manager (e.g.):
1313
14-
with LatestMessages(queues, broker_url) as messages:
15-
while some_predicate():
16-
msgs = messages.consume()
17-
if not msgs:
18-
continue
19-
20-
for routing_key, msg in msgs.items():
21-
...
14+
.. code-block:: python
15+
16+
with LatestMessages(queues, broker_url) as messages:
17+
while some_predicate():
18+
msgs = messages.consume()
19+
if not msgs:
20+
continue
21+
22+
for routing_key, msg in msgs.items():
23+
...
2224
2325
Upon exiting the the context, a LatestMessage object will no longer
2426
listen for any messages.

src/decisionengine/framework/util/countdown.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class Countdown:
1212
should not take longer than a specified period of time. This is done
1313
by occasionally querying the 'time_left' attribute (e.g.):
1414
15+
.. code-block:: python
16+
1517
countdown = Countdown(wait_up_to=10)
1618
for p in processes:
1719
with countdown:

src/decisionengine/framework/util/reaper.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@
66
"""
77
A stand-alone script purges data in database older than specified
88
in configuration. Configuration file has to have this bit added:
9-
{
10-
"dataspace" : { "retention_interval_in_days" : 365,
11-
"datasource" : { ... }
12-
}
13-
}
9+
10+
.. code-block:: json
11+
12+
{
13+
"dataspace" : {
14+
"retention_interval_in_days" : 365,
15+
"datasource" : {}
16+
}
17+
}
18+
1419
Can be used in a cron job.
1520
"""
1621
import os

0 commit comments

Comments
 (0)