sirmordred 0.10.10__tar.gz → 1.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. {sirmordred-0.10.10 → sirmordred-1.1.5}/PKG-INFO +9 -10
  2. {sirmordred-0.10.10 → sirmordred-1.1.5}/README.md +4 -4
  3. {sirmordred-0.10.10 → sirmordred-1.1.5}/pyproject.toml +7 -7
  4. sirmordred-1.1.5/sirmordred/_version.py +2 -0
  5. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/sirmordred.py +34 -5
  6. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/task.py +4 -13
  7. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/task_autorefresh.py +2 -2
  8. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/task_collection.py +6 -6
  9. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/task_enrich.py +6 -2
  10. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/task_identities.py +2 -2
  11. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/task_manager.py +3 -2
  12. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/task_panels.py +4 -4
  13. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/utils/micro.py +42 -6
  14. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_task.py +19 -13
  15. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_task_autorefresh.py +19 -15
  16. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_task_collection.py +4 -2
  17. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_task_enrich.py +66 -45
  18. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_task_identities.py +21 -10
  19. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_task_manager.py +19 -6
  20. sirmordred-0.10.10/sirmordred/_version.py +0 -2
  21. {sirmordred-0.10.10 → sirmordred-1.1.5}/LICENSE +0 -0
  22. {sirmordred-0.10.10 → sirmordred-1.1.5}/menu.yaml +0 -0
  23. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/__init__.py +0 -0
  24. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/bin/sirmordred.py +0 -0
  25. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/config.py +0 -0
  26. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/error.py +0 -0
  27. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/github.py +0 -0
  28. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/task_projects.py +0 -0
  29. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/utils/find_affiliation_conflicts.py +0 -0
  30. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/utils/grimoirelab_valid.yml +0 -0
  31. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/utils/healthcheck.py +0 -0
  32. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/utils/logs/all.log +0 -0
  33. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/utils/panels_config.py +0 -0
  34. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/utils/projects.json +0 -0
  35. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/utils/projects_json2yml.py +0 -0
  36. {sirmordred-0.10.10 → sirmordred-1.1.5}/sirmordred/utils/setup.cfg +0 -0
  37. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/aliases.json +0 -0
  38. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/askbot.archive +0 -0
  39. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/bugzilla.archive +0 -0
  40. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/bugzillarest.archive +0 -0
  41. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/confluence.archive +0 -0
  42. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/crates.archive +0 -0
  43. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/discourse.archive +0 -0
  44. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/dockerhub.archive +0 -0
  45. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/functest.archive +0 -0
  46. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/gerrit.archive +0 -0
  47. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/github-issue.archive +0 -0
  48. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/github-pull.archive +0 -0
  49. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/gitlab-issue.archive +0 -0
  50. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/gitlab-merge.archive +0 -0
  51. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/googlehits.archive +0 -0
  52. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/jenkins.archive +0 -0
  53. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/jira.archive +0 -0
  54. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/launchpad.archive +0 -0
  55. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/mediawiki-1.23.archive +0 -0
  56. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/mediawiki-1.28.archive +0 -0
  57. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/meetup.archive +0 -0
  58. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/mozillaclub.archive +0 -0
  59. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/nntp.archive +0 -0
  60. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/phabricator.archive +0 -0
  61. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/redmine.archive +0 -0
  62. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/remo.archive +0 -0
  63. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/rss.archive +0 -0
  64. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/slack.archive +0 -0
  65. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/stackexchange.archive +0 -0
  66. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/telegram.archive +0 -0
  67. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives/twitter.archive +0 -0
  68. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives-test-projects.json +0 -0
  69. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/archives-test.cfg +0 -0
  70. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/eclipse-projects.json +0 -0
  71. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/healthcheck_cache_invalid.json +0 -0
  72. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/healthcheck_cache_valid.json +0 -0
  73. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/healthcheck_cache_wrong_key.json +0 -0
  74. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/mordred.log +0 -0
  75. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/orgs_sortinghat.json +0 -0
  76. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/perceval_identities_sortinghat.json +0 -0
  77. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/remote_identities_sortinghat.json +0 -0
  78. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/task-identities-data.json +0 -0
  79. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/task-params-expected +0 -0
  80. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/task-params-test-projects.json +0 -0
  81. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/task-params-test.cfg +0 -0
  82. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/data/url-projects.json +0 -0
  83. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/run_tests.py +0 -0
  84. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/sortinghat_settings.py +0 -0
  85. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test-no-collection.cfg +0 -0
  86. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test-no-sh.cfg +0 -0
  87. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test-projects-no-collection.json +0 -0
  88. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test-projects.json +0 -0
  89. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test-repos-projects.json +0 -0
  90. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test-repos.cfg +0 -0
  91. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test.cfg +0 -0
  92. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_config.py +0 -0
  93. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_github.py +0 -0
  94. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_healthcheck.py +0 -0
  95. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_sirmordred.py +0 -0
  96. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_studies.cfg +0 -0
  97. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_task_panels.py +0 -0
  98. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_task_projects.py +0 -0
  99. {sirmordred-0.10.10 → sirmordred-1.1.5}/tests/test_wrong.cfg +0 -0
@@ -1,27 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sirmordred
3
- Version: 0.10.10
3
+ Version: 1.1.5
4
4
  Summary: Drive GrimoireLab tools to produce a dashboard
5
5
  Home-page: https://chaoss.github.io/grimoirelab/
6
6
  License: GPL-3.0+
7
7
  Keywords: development,grimoirelab
8
8
  Author: GrimoireLab Developers
9
- Requires-Python: >=3.8,<4.0
10
- Classifier: Development Status :: 4 - Beta
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Intended Audience :: Science/Research
13
13
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.8
16
15
  Classifier: Programming Language :: Python :: 3.9
17
16
  Classifier: Programming Language :: Python :: 3.10
18
17
  Classifier: Programming Language :: Python :: 3.11
19
18
  Classifier: Topic :: Software Development
20
19
  Requires-Dist: cereslib (>=0.3)
21
- Requires-Dist: colorlog (==4.1.0)
20
+ Requires-Dist: colorlog (>=6.4.1,<7.0.0)
22
21
  Requires-Dist: elasticsearch (==6.3.1)
23
22
  Requires-Dist: elasticsearch-dsl (==6.3.1)
24
- Requires-Dist: file-read-backwards (==2.0.0)
23
+ Requires-Dist: file-read-backwards (>=3.1.0,<4.0.0)
25
24
  Requires-Dist: graal (>=0.3)
26
25
  Requires-Dist: grimoire-elk (>=0.102)
27
26
  Requires-Dist: grimoirelab-panels (>=0.1)
@@ -37,7 +36,7 @@ Project-URL: Bug Tracker, https://github.com/chaoss/grimoirelab-sirmordred/issue
37
36
  Project-URL: Repository, https://github.com/chaoss/grimoirelab-sirmordred
38
37
  Description-Content-Type: text/markdown
39
38
 
40
- # SirMordred [![Build Status](https://github.com/chaoss/grimoirelab-sirmordred/workflows/tests/badge.svg)](https://github.com/chaoss/grimoirelab-sirmordred/actions?query=workflow:tests+branch:master+event:push) [![Coverage Status](https://coveralls.io/repos/github/chaoss/grimoirelab-sirmordred/badge.svg?branch=master)](https://coveralls.io/github/chaoss/grimoirelab-sirmordred?branch=master) [![PyPI version](https://badge.fury.io/py/sirmordred.svg)](https://badge.fury.io/py/sirmordred)
39
+ # SirMordred [![Build Status](https://github.com/chaoss/grimoirelab-sirmordred/workflows/tests/badge.svg)](https://github.com/chaoss/grimoirelab-sirmordred/actions?query=workflow:tests+branch:main+event:push) [![Coverage Status](https://coveralls.io/repos/github/chaoss/grimoirelab-sirmordred/badge.svg?branch=main)](https://coveralls.io/github/chaoss/grimoirelab-sirmordred?branch=main) [![PyPI version](https://badge.fury.io/py/sirmordred.svg)](https://badge.fury.io/py/sirmordred)
41
40
 
42
41
  SirMordred is the tool used to coordinate the execution of the GrimoireLab platform, via two main configuration files, the `setup.cfg` and `projects.json`, which are summarized in their corresponding sections.
43
42
 
@@ -143,7 +142,7 @@ The template of a backend section is shown above.
143
142
  Further information about Perceval backends parameters are available at:
144
143
 
145
144
  * Params details: https://perceval.readthedocs.io/en/latest/perceval/perceval-backends.html
146
- * Examples: https://github.com/chaoss/grimoirelab-sirmordred/blob/master/tests/test_studies.cfg
145
+ * Examples: https://github.com/chaoss/grimoirelab-sirmordred/blob/main/tests/test_studies.cfg
147
146
 
148
147
  Note that some backend sections allow to specify specific enrichment options, which are listed below.
149
148
 
@@ -160,7 +159,7 @@ Note that some backend sections allow to specify specific enrichment options, wh
160
159
 
161
160
  A template of a study section is shown above. A complete list of studies parameters is available at:
162
161
 
163
- * https://github.com/chaoss/grimoirelab-sirmordred/blob/master/tests/test_studies.cfg
162
+ * https://github.com/chaoss/grimoirelab-sirmordred/blob/main/tests/test_studies.cfg
164
163
 
165
164
  ## Projects.json [&uarr;](#contents)
166
165
 
@@ -1473,7 +1472,7 @@ studies = [enrich_demography:weblate] (optional)
1473
1472
 
1474
1473
  Micro Mordred is a simplified version of Mordred which omits the use of its scheduler. Thus, Micro Mordred allows running single Mordred tasks (e.g., raw collection, enrichment) per execution.
1475
1474
 
1476
- Micro Mordred is located in the [sirmordred/utils](https://github.com/chaoss/grimoirelab-sirmordred/tree/master/sirmordred/utils/micro.py) folder of this same repository. It can be executed via command line, its parameters are summarized below:
1475
+ Micro Mordred is located in the [sirmordred/utils](https://github.com/chaoss/grimoirelab-sirmordred/tree/main/sirmordred/utils/micro.py) folder of this same repository. It can be executed via command line, its parameters are summarized below:
1477
1476
  ```
1478
1477
  --debug: execute Micro Mordred in debug mode
1479
1478
 
@@ -1,4 +1,4 @@
1
- # SirMordred [![Build Status](https://github.com/chaoss/grimoirelab-sirmordred/workflows/tests/badge.svg)](https://github.com/chaoss/grimoirelab-sirmordred/actions?query=workflow:tests+branch:master+event:push) [![Coverage Status](https://coveralls.io/repos/github/chaoss/grimoirelab-sirmordred/badge.svg?branch=master)](https://coveralls.io/github/chaoss/grimoirelab-sirmordred?branch=master) [![PyPI version](https://badge.fury.io/py/sirmordred.svg)](https://badge.fury.io/py/sirmordred)
1
+ # SirMordred [![Build Status](https://github.com/chaoss/grimoirelab-sirmordred/workflows/tests/badge.svg)](https://github.com/chaoss/grimoirelab-sirmordred/actions?query=workflow:tests+branch:main+event:push) [![Coverage Status](https://coveralls.io/repos/github/chaoss/grimoirelab-sirmordred/badge.svg?branch=main)](https://coveralls.io/github/chaoss/grimoirelab-sirmordred?branch=main) [![PyPI version](https://badge.fury.io/py/sirmordred.svg)](https://badge.fury.io/py/sirmordred)
2
2
 
3
3
  SirMordred is the tool used to coordinate the execution of the GrimoireLab platform, via two main configuration files, the `setup.cfg` and `projects.json`, which are summarized in their corresponding sections.
4
4
 
@@ -104,7 +104,7 @@ The template of a backend section is shown above.
104
104
  Further information about Perceval backends parameters are available at:
105
105
 
106
106
  * Params details: https://perceval.readthedocs.io/en/latest/perceval/perceval-backends.html
107
- * Examples: https://github.com/chaoss/grimoirelab-sirmordred/blob/master/tests/test_studies.cfg
107
+ * Examples: https://github.com/chaoss/grimoirelab-sirmordred/blob/main/tests/test_studies.cfg
108
108
 
109
109
  Note that some backend sections allow to specify specific enrichment options, which are listed below.
110
110
 
@@ -121,7 +121,7 @@ Note that some backend sections allow to specify specific enrichment options, wh
121
121
 
122
122
  A template of a study section is shown above. A complete list of studies parameters is available at:
123
123
 
124
- * https://github.com/chaoss/grimoirelab-sirmordred/blob/master/tests/test_studies.cfg
124
+ * https://github.com/chaoss/grimoirelab-sirmordred/blob/main/tests/test_studies.cfg
125
125
 
126
126
  ## Projects.json [&uarr;](#contents)
127
127
 
@@ -1434,7 +1434,7 @@ studies = [enrich_demography:weblate] (optional)
1434
1434
 
1435
1435
  Micro Mordred is a simplified version of Mordred which omits the use of its scheduler. Thus, Micro Mordred allows running single Mordred tasks (e.g., raw collection, enrichment) per execution.
1436
1436
 
1437
- Micro Mordred is located in the [sirmordred/utils](https://github.com/chaoss/grimoirelab-sirmordred/tree/master/sirmordred/utils/micro.py) folder of this same repository. It can be executed via command line, its parameters are summarized below:
1437
+ Micro Mordred is located in the [sirmordred/utils](https://github.com/chaoss/grimoirelab-sirmordred/tree/main/sirmordred/utils/micro.py) folder of this same repository. It can be executed via command line, its parameters are summarized below:
1438
1438
  ```
1439
1439
  --debug: execute Micro Mordred in debug mode
1440
1440
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "sirmordred"
3
- version = "0.10.10"
3
+ version = "1.1.5"
4
4
  description = "Drive GrimoireLab tools to produce a dashboard"
5
5
  authors = [
6
6
  "GrimoireLab Developers"
@@ -23,7 +23,7 @@ packages = [
23
23
  ]
24
24
 
25
25
  classifiers = [
26
- "Development Status :: 4 - Beta",
26
+ "Development Status :: 5 - Production/Stable",
27
27
  "Intended Audience :: Developers",
28
28
  "Intended Audience :: Science/Research",
29
29
  "Topic :: Software Development",
@@ -41,12 +41,12 @@ classifiers = [
41
41
  'panels_config.py' = 'sirmordred.utils.panels_config:main'
42
42
 
43
43
  [tool.poetry.dependencies]
44
- python = "^3.8"
44
+ python = "^3.9"
45
45
 
46
- colorlog = "4.1.0"
46
+ colorlog = "^6.4.1"
47
47
  elasticsearch = "6.3.1"
48
48
  elasticsearch-dsl = "6.3.1"
49
- file-read-backwards = "2.0.0"
49
+ file-read-backwards = "^3.1.0"
50
50
  grimoirelab-toolkit = { version = ">=0.3", allow-prereleases = true}
51
51
  sortinghat = { version = ">=0.7.20", allow-prereleases = true}
52
52
  kidash = { version = ">=0.5", allow-prereleases = true}
@@ -62,8 +62,8 @@ graal = { version = ">=0.3", allow-prereleases = true}
62
62
 
63
63
  [tool.poetry.dev-dependencies]
64
64
  httpretty = "^1.1.4"
65
- flake8 = "^4.0.1"
66
- coverage = "^6.3.2"
65
+ flake8 = "^7.1.1"
66
+ coverage = "^7.2.3"
67
67
 
68
68
  [build-system]
69
69
  requires = ["poetry-core>=1.0.0"]
@@ -0,0 +1,2 @@
1
+ # File auto-generated by semverup on 2025-01-15 12:24:38.123061
2
+ __version__ = "1.1.5"
@@ -50,6 +50,7 @@ from sirmordred.task_identities import TaskIdentitiesMerge
50
50
  from sirmordred.task_manager import TasksManager
51
51
  from sirmordred.task_panels import TaskPanels, TaskPanelsMenu
52
52
  from sirmordred.task_projects import TaskProjects
53
+ from sortinghat.cli.client import SortingHatClient
53
54
 
54
55
  logger = logging.getLogger(__name__)
55
56
 
@@ -198,7 +199,7 @@ class SirMordred:
198
199
  repos_backend = self._get_repos_by_backend()
199
200
  for backend in repos_backend:
200
201
  # Start new Threads and add them to the threads list to complete
201
- t = TasksManager(backend_tasks, backend, stopper, self.config, small_delay)
202
+ t = TasksManager(backend_tasks, backend, stopper, self.config, self.client, small_delay)
202
203
  threads.append(t)
203
204
  t.start()
204
205
 
@@ -206,7 +207,7 @@ class SirMordred:
206
207
  if len(global_tasks) > 0:
207
208
  # FIXME timer is applied to all global_tasks, does it make sense?
208
209
  # All tasks are executed in the same thread sequentially
209
- gt = TasksManager(global_tasks, "Global tasks", stopper, self.config, big_delay)
210
+ gt = TasksManager(global_tasks, "Global tasks", stopper, self.config, self.client, big_delay)
210
211
  threads.append(gt)
211
212
  gt.start()
212
213
  if big_delay > 0:
@@ -248,14 +249,14 @@ class SirMordred:
248
249
  if self.conf['phases']['panels']:
249
250
  tasks = [TaskPanels, TaskPanelsMenu]
250
251
  stopper.set()
251
- tm = TasksManager(tasks, "Global tasks", stopper, self.config)
252
+ tm = TasksManager(tasks, "Global tasks", stopper, self.config, self.client)
252
253
  tm.start()
253
254
  tm.join()
254
255
 
255
256
  logger.info("Loading projects")
256
257
  tasks = [TaskProjects]
257
258
  stopper.set()
258
- tm = TasksManager(tasks, "Global tasks", stopper, self.config)
259
+ tm = TasksManager(tasks, "Global tasks", stopper, self.config, self.client)
259
260
  tm.start()
260
261
  tm.join()
261
262
  logger.info("Projects loaded")
@@ -280,7 +281,7 @@ class SirMordred:
280
281
 
281
282
  # check we have access to the needed ES
282
283
  if not self.check_es_access():
283
- print('Can not access Elasticsearch service. Exiting sirmordred ...')
284
+ print('Can not access ElasticSearch/OpenSearch service. Exiting sirmordred ...')
284
285
  sys.exit(1)
285
286
 
286
287
  # If bestiary is configured check that it is working
@@ -289,6 +290,9 @@ class SirMordred:
289
290
  print('Can not access bestiary service. Exiting sirmordred ...')
290
291
  sys.exit(1)
291
292
 
293
+ # Create SortingHat Client
294
+ self.__create_sh_client(self.config)
295
+
292
296
  # Initial round: panels and projects loading
293
297
  self.__execute_initial_load()
294
298
 
@@ -336,3 +340,28 @@ class SirMordred:
336
340
  logger.error(var)
337
341
 
338
342
  logger.info("Finished SirMordred engine ...")
343
+
344
+ def __create_sh_client(self, config):
345
+ self.config = config
346
+ self.conf = config.get_conf()
347
+
348
+ sortinghat = self.conf.get('sortinghat', None)
349
+ self.db_sh = sortinghat['database'] if sortinghat else None
350
+ self.db_user = sortinghat['user'] if sortinghat else None
351
+ self.db_password = sortinghat['password'] if sortinghat else None
352
+ self.db_host = sortinghat['host'] if sortinghat else '127.0.0.1'
353
+ self.db_path = sortinghat.get('path', None) if sortinghat else None
354
+ self.db_port = sortinghat.get('port', None) if sortinghat else None
355
+ self.db_ssl = sortinghat.get('ssl', False) if sortinghat else False
356
+ self.db_verify_ssl = sortinghat.get('verify_ssl', True) if sortinghat else True
357
+ self.db_tenant = sortinghat.get('tenant', True) if sortinghat else None
358
+ self.db_unaffiliate_group = sortinghat['unaffiliated_group'] if sortinghat else None
359
+ if sortinghat and not hasattr(self, 'client'):
360
+ self.client = SortingHatClient(host=self.db_host, port=self.db_port,
361
+ path=self.db_path, ssl=self.db_ssl,
362
+ user=self.db_user, password=self.db_password,
363
+ verify_ssl=self.db_verify_ssl,
364
+ tenant=self.db_tenant)
365
+ self.client.connect()
366
+ elif not sortinghat:
367
+ self.client = None
@@ -29,7 +29,6 @@ import re
29
29
  from grimoire_elk.elk import get_ocean_backend
30
30
  from grimoire_elk.utils import get_connector_from_name, get_elastic
31
31
  from grimoire_elk.enriched.utils import grimoire_con
32
- from sortinghat.cli.client import SortingHatClient
33
32
 
34
33
  logger = logging.getLogger(__name__)
35
34
 
@@ -42,10 +41,11 @@ class Task():
42
41
  'studies', 'node_regex', 'anonymize']
43
42
  PARAMS_WITH_SPACES = ['blacklist-jobs']
44
43
 
45
- def __init__(self, config):
44
+ def __init__(self, config, sortinghat_client=None):
46
45
  self.backend_section = None
47
46
  self.config = config
48
47
  self.conf = config.get_conf()
48
+ self.client = sortinghat_client
49
49
 
50
50
  sortinghat = self.conf.get('sortinghat', None)
51
51
  self.db_sh = sortinghat['database'] if sortinghat else None
@@ -58,15 +58,6 @@ class Task():
58
58
  self.db_verify_ssl = sortinghat.get('verify_ssl', True) if sortinghat else True
59
59
  self.db_tenant = sortinghat.get('tenant', True) if sortinghat else None
60
60
  self.db_unaffiliate_group = sortinghat['unaffiliated_group'] if sortinghat else None
61
- if sortinghat:
62
- self.client = SortingHatClient(host=self.db_host, port=self.db_port,
63
- path=self.db_path, ssl=self.db_ssl,
64
- user=self.db_user, password=self.db_password,
65
- verify_ssl=self.db_verify_ssl,
66
- tenant=self.db_tenant)
67
- self.client.connect()
68
- else:
69
- self.client = None
70
61
 
71
62
  self.grimoire_con = grimoire_con(conn_retries=12) # 30m retry
72
63
 
@@ -156,9 +147,9 @@ class Task():
156
147
  continue
157
148
 
158
149
  # If param is boolean, no values must be added
159
- if type(section_param) == bool:
150
+ if isinstance(section_param, bool):
160
151
  params.append("--" + p) if section_param else None
161
- elif type(section_param) == list:
152
+ elif isinstance(section_param, list):
162
153
  # '--blacklist-jobs', 'a', 'b', 'c'
163
154
  # 'a', 'b', 'c' must be added as items in the list
164
155
  params.append("--" + p)
@@ -43,8 +43,8 @@ logger = logging.getLogger(__name__)
43
43
  class TaskAutorefresh(Task):
44
44
  """Refresh the last modified identities for all the backends."""
45
45
 
46
- def __init__(self, config):
47
- super().__init__(config)
46
+ def __init__(self, config, sortinghat_client):
47
+ super().__init__(config, sortinghat_client)
48
48
 
49
49
  self.last_autorefresh_backend = {}
50
50
 
@@ -22,13 +22,14 @@
22
22
  #
23
23
 
24
24
  import logging
25
- import time
26
25
  import traceback
27
26
 
28
27
  from grimoire_elk.elk import feed_backend
29
28
  from grimoire_elk.elastic_items import ElasticItems
30
29
  from grimoire_elk.elastic import ElasticSearch
31
30
 
31
+ from grimoirelab_toolkit.datetime import datetime_utcnow
32
+
32
33
  from sirmordred.error import DataCollectionError
33
34
  from sirmordred.task import Task
34
35
  from sirmordred.task_projects import TaskProjects
@@ -40,8 +41,8 @@ logger = logging.getLogger(__name__)
40
41
  class TaskRawDataCollection(Task):
41
42
  """ Basic class shared by all collection tasks """
42
43
 
43
- def __init__(self, config, backend_section=None, allowed_repos=None):
44
- super().__init__(config)
44
+ def __init__(self, config, sortinghat_client=None, backend_section=None, allowed_repos=None):
45
+ super().__init__(config, sortinghat_client)
45
46
 
46
47
  self.backend_section = backend_section
47
48
  self.allowed_repos = set(allowed_repos) if allowed_repos else None
@@ -74,7 +75,7 @@ class TaskRawDataCollection(Task):
74
75
  logging.info('%s collect disabled', self.backend_section)
75
76
  return errors
76
77
 
77
- t2 = time.time()
78
+ time_start = datetime_utcnow()
78
79
  logger.info('[%s] collection phase starts', self.backend_section)
79
80
  print("Collection for {}: starting...".format(self.backend_section))
80
81
  clean = False
@@ -142,8 +143,7 @@ class TaskRawDataCollection(Task):
142
143
  raise DataCollectionError('Failed to collect data from %s' % url)
143
144
  logger.info('[%s] collection finished for %s', self.backend_section, self.anonymize_url(repo))
144
145
 
145
- t3 = time.time()
146
- spent_time = time.strftime("%H:%M:%S", time.gmtime(t3 - t2))
146
+ spent_time = str(datetime_utcnow() - time_start).split('.')[0]
147
147
  logger.info('[%s] collection phase finished in %s',
148
148
  self.backend_section, spent_time)
149
149
  print("Collection for {}: finished after {} hours".format(self.backend_section,
@@ -53,8 +53,8 @@ logger = logging.getLogger(__name__)
53
53
  class TaskEnrich(Task):
54
54
  """ Basic class shared by all enriching tasks """
55
55
 
56
- def __init__(self, config, backend_section=None, allowed_repos=None):
57
- super().__init__(config)
56
+ def __init__(self, config, sortinghat_client, backend_section=None, allowed_repos=None):
57
+ super().__init__(config, sortinghat_client)
58
58
  self.backend_section = backend_section
59
59
  self.allowed_repos = set(allowed_repos) if allowed_repos else None
60
60
  # This will be options in next iteration
@@ -249,12 +249,16 @@ class TaskEnrich(Task):
249
249
  next_autorefresh = self.__update_last_autorefresh()
250
250
 
251
251
  logger.debug('Getting last modified identities from SH since %s for %s', after, self.backend_section)
252
+
252
253
  author_fields = ["author_uuid"]
254
+ for role in enrich_backend.roles:
255
+ author_fields.append(role + '_uuid')
253
256
  try:
254
257
  meta_fields = enrich_backend.meta_fields
255
258
  author_fields += meta_fields
256
259
  except AttributeError:
257
260
  pass
261
+
258
262
  logger.debug("Refreshing identity ids for %s", self.backend_section)
259
263
  total = 0
260
264
  time_start = datetime.now()
@@ -38,8 +38,8 @@ logger = logging.getLogger(__name__)
38
38
  class TaskIdentitiesMerge(Task):
39
39
  """ Task for processing identities in SortingHat """
40
40
 
41
- def __init__(self, conf):
42
- super().__init__(conf)
41
+ def __init__(self, conf, sortinghat_client):
42
+ super().__init__(conf, sortinghat_client)
43
43
  self.last_autorefresh = datetime.utcnow() # Last autorefresh date
44
44
 
45
45
  def is_backend_task(self):
@@ -50,7 +50,7 @@ class TasksManager(threading.Thread):
50
50
  IDENTITIES_TASKS_ON_LOCK = threading.Lock()
51
51
  IDENTITIES_TASKS_ON = False
52
52
 
53
- def __init__(self, tasks_cls, backend_section, stopper, config, timer=0):
53
+ def __init__(self, tasks_cls, backend_section, stopper, config, sortinghat_client, timer=0):
54
54
  """
55
55
  :tasks_cls : tasks classes to be executed using the backend
56
56
  :backend_section: perceval backend section name
@@ -64,6 +64,7 @@ class TasksManager(threading.Thread):
64
64
  self.stopper = stopper # To stop the thread from parent
65
65
  self.timer = timer
66
66
  self.thread_id = None
67
+ self.client = sortinghat_client
67
68
 
68
69
  def add_task(self, task):
69
70
  self.tasks.append(task)
@@ -80,7 +81,7 @@ class TasksManager(threading.Thread):
80
81
  logger.debug(self.tasks_cls)
81
82
  for tc in self.tasks_cls:
82
83
  # create the real Task from the class
83
- task = tc(self.config)
84
+ task = tc(self.config, self.client)
84
85
  task.set_backend_section(self.backend_section)
85
86
  self.tasks.append(task)
86
87
 
@@ -264,8 +264,8 @@ class TaskPanels(Task):
264
264
  # Panels to be uploaded always, no matter the data sources configured
265
265
  panels_common = panels_multi_ds + ["panels/json/about.json"]
266
266
 
267
- def __init__(self, conf):
268
- super().__init__(conf)
267
+ def __init__(self, conf, sortinghat_client=None):
268
+ super().__init__(conf, sortinghat_client)
269
269
  # Read panels and menu description from yaml file
270
270
  with open(self.conf['general']['menu_file'], 'r') as f:
271
271
  try:
@@ -473,8 +473,8 @@ class TaskPanelsMenu(Task):
473
473
  }
474
474
  }
475
475
 
476
- def __init__(self, conf):
477
- super().__init__(conf)
476
+ def __init__(self, conf, sortinghat_client=None):
477
+ super().__init__(conf, sortinghat_client)
478
478
  # Read panels and menu description from yaml file """
479
479
  with open(self.conf['general']['menu_file'], 'r') as f:
480
480
  try:
@@ -33,6 +33,7 @@ from sirmordred.task_identities import TaskIdentitiesMerge
33
33
  from sirmordred.task_enrich import TaskEnrich
34
34
  from sirmordred.task_panels import TaskPanels, TaskPanelsMenu
35
35
  from sirmordred.task_projects import TaskProjects
36
+ from sortinghat.cli.client import SortingHatClient
36
37
 
37
38
  COLOR_LOG_FORMAT_SUFFIX = "\033[1m %(log_color)s "
38
39
  LOG_COLORS = {'DEBUG': 'white', 'INFO': 'cyan', 'WARNING': 'yellow', 'ERROR': 'red', 'CRITICAL': 'red,bg_white'}
@@ -50,6 +51,34 @@ def main():
50
51
  args.panels)
51
52
 
52
53
 
54
+ def create_sortinghat_client(config):
55
+ """Create a SortingHat client"""
56
+
57
+ conf = config.get_conf()
58
+
59
+ sortinghat = conf.get('sortinghat', None)
60
+ if not sortinghat:
61
+ return None
62
+
63
+ db_user = sortinghat['user'] if sortinghat else None
64
+ db_password = sortinghat['password'] if sortinghat else None
65
+ db_host = sortinghat['host'] if sortinghat else '127.0.0.1'
66
+ db_path = sortinghat.get('path', None) if sortinghat else None
67
+ db_port = sortinghat.get('port', None) if sortinghat else None
68
+ db_ssl = sortinghat.get('ssl', False) if sortinghat else False
69
+ db_verify_ssl = sortinghat.get('verify_ssl', True) if sortinghat else True
70
+ db_tenant = sortinghat.get('tenant', True) if sortinghat else None
71
+
72
+ client = SortingHatClient(host=db_host, port=db_port,
73
+ path=db_path, ssl=db_ssl,
74
+ user=db_user, password=db_password,
75
+ verify_ssl=db_verify_ssl,
76
+ tenant=db_tenant)
77
+ client.connect()
78
+
79
+ return client
80
+
81
+
53
82
  def micro_mordred(config, backend_sections, repos_to_check, raw, identities_merge, enrich, panels):
54
83
  """Execute the Mordred tasks using the configuration file.
55
84
 
@@ -66,12 +95,17 @@ def micro_mordred(config, backend_sections, repos_to_check, raw, identities_merg
66
95
  for backend in backend_sections:
67
96
  get_raw(config, backend, repos_to_check)
68
97
 
98
+ if identities_merge or enrich:
99
+ sortinghat_client = create_sortinghat_client(config)
100
+ else:
101
+ sortinghat_client = None
102
+
69
103
  if identities_merge:
70
- get_identities_merge(config)
104
+ get_identities_merge(config, sortinghat_client)
71
105
 
72
106
  if enrich:
73
107
  for backend in backend_sections:
74
- get_enrich(config, backend, repos_to_check)
108
+ get_enrich(config, sortinghat_client, backend, repos_to_check)
75
109
 
76
110
  if panels:
77
111
  get_panels(config)
@@ -97,29 +131,31 @@ def get_raw(config, backend_section, repos_to_check=None):
97
131
  sys.exit(-1)
98
132
 
99
133
 
100
- def get_identities_merge(config):
134
+ def get_identities_merge(config, sortinghat_client):
101
135
  """Execute the merge identities phase
102
136
 
137
+ :param sortinghat_client: a SortingHat client
103
138
  :param config: a Mordred config object
104
139
  """
105
140
  TaskProjects(config).execute()
106
- task = TaskIdentitiesMerge(config)
141
+ task = TaskIdentitiesMerge(config, sortinghat_client)
107
142
  task.execute()
108
143
  logging.info("Merging identities finished!")
109
144
 
110
145
 
111
- def get_enrich(config, backend_section, repos_to_check=None):
146
+ def get_enrich(config, sortinghat_client, backend_section, repos_to_check=None):
112
147
  """Execute the enrich phase for a given backend section
113
148
 
114
149
  Repos are only checked if they are in BOTH `repos_to_check` and the `projects.json`
115
150
 
116
151
  :param config: a Mordred config object
152
+ :param sortinghat_client: a SortingHat client
117
153
  :param backend_section: the backend section where the enrich phase is executed
118
154
  :param repos_to_check: A list of repo URLs to check, or None to check all repos
119
155
  """
120
156
 
121
157
  TaskProjects(config).execute()
122
- task = TaskEnrich(config, backend_section=backend_section, allowed_repos=repos_to_check)
158
+ task = TaskEnrich(config, sortinghat_client, backend_section=backend_section, allowed_repos=repos_to_check)
123
159
  try:
124
160
  task.execute()
125
161
  logging.info("Loading enriched data finished!")
@@ -33,6 +33,8 @@ sys.path.insert(0, '..')
33
33
  from sirmordred.config import Config
34
34
  from sirmordred.task import Task
35
35
 
36
+ from sortinghat.cli.client import SortingHatClient
37
+
36
38
  CONF_FILE = 'test.cfg'
37
39
  BACKEND_NAME = 'stackexchange'
38
40
  COLLECTION_URL_STACKEXCHANGE = 'http://127.0.0.1:9200'
@@ -47,14 +49,23 @@ def read_file(filename, mode='r'):
47
49
 
48
50
  class TestTask(unittest.TestCase):
49
51
  """Task tests"""
52
+ def setUp(self):
53
+ self.config = Config(CONF_FILE)
54
+ self.conf = self.config.get_conf()
55
+ sh = self.conf.get('sortinghat')
56
+ self.sortinghat_client = SortingHatClient(host=sh['host'], port=sh.get('port', None),
57
+ path=sh.get('path', None), ssl=sh.get('ssl', False),
58
+ user=sh['user'], password=sh['password'],
59
+ verify_ssl=sh.get('verify_ssl', True),
60
+ tenant=sh.get('tenant', True))
61
+ self.sortinghat_client.connect()
50
62
 
51
63
  def test_initialization(self):
52
64
  """Test whether attributes are initializated"""
53
65
 
54
- config = Config(CONF_FILE)
55
- task = Task(config)
66
+ task = Task(self.config, self.sortinghat_client)
56
67
 
57
- self.assertEqual(task.config, config)
68
+ self.assertEqual(task.config, self.config)
58
69
  self.assertEqual(task.db_sh, task.conf['sortinghat']['database'])
59
70
  self.assertEqual(task.db_user, task.conf['sortinghat']['user'])
60
71
  self.assertEqual(task.db_password, task.conf['sortinghat']['password'])
@@ -63,15 +74,13 @@ class TestTask(unittest.TestCase):
63
74
  def test_run(self):
64
75
  """Test whether the Task could be run"""
65
76
 
66
- config = Config(CONF_FILE)
67
- task = Task(config)
77
+ task = Task(self.config, self.sortinghat_client)
68
78
  self.assertEqual(task.execute(), None)
69
79
 
70
80
  def test_compose_p2o_params(self):
71
81
  """Test whether p2o params are built correctly for a backend and a repository"""
72
82
 
73
- config = Config(CONF_FILE)
74
- task = Task(config)
83
+ task = Task(self.config, self.sortinghat_client)
75
84
  params = task._compose_p2o_params("stackexchange", "https://stackoverflow.com/questions/tagged/example")
76
85
  self.assertDictEqual(params, {'url': "https://stackoverflow.com/questions/tagged/example"})
77
86
 
@@ -92,8 +101,7 @@ class TestTask(unittest.TestCase):
92
101
  def test_extract_repo_tags(self):
93
102
  """Test the extraction of tags in repositories"""
94
103
 
95
- config = Config(CONF_FILE)
96
- task = Task(config)
104
+ task = Task(self.config, self.sortinghat_client)
97
105
  url, tags = task._extract_repo_tags("git", "https://github.com/zhquan_example/repo --labels=[ENG, SUPP]")
98
106
  self.assertEqual(url, "https://github.com/zhquan_example/repo")
99
107
  self.assertListEqual(tags, ["ENG", "SUPP"])
@@ -113,8 +121,7 @@ class TestTask(unittest.TestCase):
113
121
 
114
122
  expected_repo_params = json.loads(read_file('data/task-params-expected'))
115
123
 
116
- config = Config(CONF_FILE)
117
- task = Task(config)
124
+ task = Task(self.config, self.sortinghat_client)
118
125
 
119
126
  for backend in expected_repo_params.keys():
120
127
  repo = expected_repo_params.get(backend)['repo']
@@ -126,8 +133,7 @@ class TestTask(unittest.TestCase):
126
133
  def test_get_collection_url(self):
127
134
  """Test whether the collection url could be overwritten in a backend"""
128
135
 
129
- config = Config(CONF_FILE)
130
- task = Task(config)
136
+ task = Task(self.config, self.sortinghat_client)
131
137
  task.backend_section = "stackexchange"
132
138
 
133
139
  self.assertEqual(task._get_collection_url(), COLLECTION_URL_STACKEXCHANGE)