sirmordred 1.0.5__py3-none-any.whl → 1.1.0__py3-none-any.whl

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.
sirmordred/_version.py CHANGED
@@ -1,2 +1,2 @@
1
- # File auto-generated by semverup on 2024-08-13 11:14:48.233111
2
- __version__ = "1.0.5"
1
+ # File auto-generated by semverup on 2024-08-30 16:33:44.883554
2
+ __version__ = "1.1.0"
sirmordred/sirmordred.py CHANGED
@@ -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
sirmordred/task.py CHANGED
@@ -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
 
@@ -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
 
sirmordred/task_enrich.py CHANGED
@@ -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
@@ -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, soringhat_client):
42
+ super().__init__(conf, soringhat_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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sirmordred
3
- Version: 1.0.5
3
+ Version: 1.1.0
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+
@@ -1,16 +1,16 @@
1
1
  sirmordred/__init__.py,sha256=vQ9Reo3DRPBCcW0QhyeK2tBCTIumq3D1BkaWXTtY8VA,835
2
- sirmordred/_version.py,sha256=laYOd3t29YaaqdubA8oFNybLdMY5uvClejYWPIIOjnY,86
2
+ sirmordred/_version.py,sha256=zezEq0tAWV6KrS1hCCTW_DReSHmMm4gC_WOzrehkce8,86
3
3
  sirmordred/bin/sirmordred.py,sha256=LmCiVYL7NBIord1Lz7RXJcRIPJtSvMT-b8QxNieRDzE,5022
4
4
  sirmordred/config.py,sha256=hxwCRQ-szIz8KXedLoJ5Tl1ktP07uZ6z2buwzkofggI,33508
5
5
  sirmordred/error.py,sha256=RD-POuigH-FEvmTu7a7qI5t78NnjkYKQ_ukfns9DozY,1836
6
6
  sirmordred/github.py,sha256=5RFYoTscKWACqMq_uJCYXv8KZD6qe7C2eBgfz0tyPpo,2306
7
- sirmordred/sirmordred.py,sha256=YRz7qhX2C2lr7IRgkt1iilDjjqv1xCZFNdw-4qcD3H0,12432
8
- sirmordred/task.py,sha256=04HFQnljFEM7x8WNZm5n5l2Z9S6Xs2BfhfyJy6NsyeE,10093
9
- sirmordred/task_autorefresh.py,sha256=vjxAudX-sQ760EDHbR5ZKPAwQKm9AiQc9FhcdesrYN0,7762
7
+ sirmordred/sirmordred.py,sha256=E1uX-j12Wz_KIsL_-BDYmW-0fkeX6y9RvgkzUiX_swA,14101
8
+ sirmordred/task.py,sha256=z5g3PGuGNE0fJ9ccis5CPMtCAiNAxHjIb_s3qPsQWKc,9615
9
+ sirmordred/task_autorefresh.py,sha256=X2sGa9kBkBsoWz5SqjzHX2sdksFNHdu3Spe6-YCvSFw,7800
10
10
  sirmordred/task_collection.py,sha256=j6UGBUeGoO1kU7cLQ7lPtqbO1JHazbbGpy4wkAeoMN0,6524
11
- sirmordred/task_enrich.py,sha256=Ms6EfNJ0w8katIiuOp3g-qToB6eYc7b1NGJ29sXm90I,21236
12
- sirmordred/task_identities.py,sha256=W_7QypyzBYW1L_XtJ1W-f5AhdK4dOOEWeXySBWFunsM,3396
13
- sirmordred/task_manager.py,sha256=zfzx2u6JRARjOyeU05Uakeef-X7hBcJlFu8NBzjCxfU,4424
11
+ sirmordred/task_enrich.py,sha256=t6PiI6s8hCxWhcPbc7qtL6rkendgrY9ycgI2PNIR8FM,21274
12
+ sirmordred/task_identities.py,sha256=EeXLQ_pN7UYw7nWC27TK0m7v5Q8xE83t0N69lJE8DjQ,3432
13
+ sirmordred/task_manager.py,sha256=xYhdmFvJpkLcJvIX50F2uvTtFevpXIckN3RrWDjej6g,4496
14
14
  sirmordred/task_panels.py,sha256=bU6s9YzpzhqX49XR7L6_IeT2dbnotEvxiLSVkuf9k1I,29060
15
15
  sirmordred/task_projects.py,sha256=gJTnGvAYbZ8HTSzXzUXw6BiJ6XaAUWY8QE9j3GgaRP0,6484
16
16
  sirmordred/utils/find_affiliation_conflicts.py,sha256=tmPk930o8MDycZcVH6T3TBtCTZia5bs1uuhI343sKfY,1981
@@ -22,8 +22,8 @@ sirmordred/utils/panels_config.py,sha256=G54oTtRppHDLRhdnaqYneUemUlWFxlX6h7GFl0L
22
22
  sirmordred/utils/projects.json,sha256=CxXpzYqvLx6FfDTPln9b5TIkfEb2cgfP20WLvwK_7GU,864
23
23
  sirmordred/utils/projects_json2yml.py,sha256=N9-orfrnfzASTYAIzR2Xo9IpW-CVdNAiVAmWT7Bt154,3141
24
24
  sirmordred/utils/setup.cfg,sha256=hKbO4euWOFYzzsGcTQk8jW6CkutOJw72TywBQdyekrA,3634
25
- sirmordred-1.0.5.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
26
- sirmordred-1.0.5.dist-info/METADATA,sha256=hASKBDyRQwKwEP8mV9k714ZVwN3zNJUrikfMi1UpTMI,42451
27
- sirmordred-1.0.5.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
28
- sirmordred-1.0.5.dist-info/entry_points.txt,sha256=HKwfuVFXnCzt8rsJBUFudGHm-KMxJ_3a1YLX-Q7WoRk,200
29
- sirmordred-1.0.5.dist-info/RECORD,,
25
+ sirmordred-1.1.0.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
26
+ sirmordred-1.1.0.dist-info/METADATA,sha256=cbdAnxs-RqNhkCsLY6OEFTwvT8jzbZvgj2d0VjdOhHw,42451
27
+ sirmordred-1.1.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
28
+ sirmordred-1.1.0.dist-info/entry_points.txt,sha256=HKwfuVFXnCzt8rsJBUFudGHm-KMxJ_3a1YLX-Q7WoRk,200
29
+ sirmordred-1.1.0.dist-info/RECORD,,