Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include days spent in collection phase logs #623

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions releases/unreleased/days-in-collection-spent-time.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Days in collection spent time
category: fixed
author: Jose Javier Merchante <[email protected]>
issue: null
notes: >
Include days in logs when the collection spent time is more than
one day.
8 changes: 4 additions & 4 deletions sirmordred/task_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
#

import logging
import time
import traceback

from grimoire_elk.elk import feed_backend
from grimoire_elk.elastic_items import ElasticItems
from grimoire_elk.elastic import ElasticSearch

from grimoirelab_toolkit.datetime import datetime_utcnow

from sirmordred.error import DataCollectionError
from sirmordred.task import Task
from sirmordred.task_projects import TaskProjects
Expand Down Expand Up @@ -74,7 +75,7 @@ def execute(self):
logging.info('%s collect disabled', self.backend_section)
return errors

t2 = time.time()
time_start = datetime_utcnow()
logger.info('[%s] collection phase starts', self.backend_section)
print("Collection for {}: starting...".format(self.backend_section))
clean = False
Expand Down Expand Up @@ -142,8 +143,7 @@ def execute(self):
raise DataCollectionError('Failed to collect data from %s' % url)
logger.info('[%s] collection finished for %s', self.backend_section, self.anonymize_url(repo))

t3 = time.time()
spent_time = time.strftime("%H:%M:%S", time.gmtime(t3 - t2))
spent_time = str(datetime_utcnow() - time_start).split('.')[0]
logger.info('[%s] collection phase finished in %s',
self.backend_section, spent_time)
print("Collection for {}: finished after {} hours".format(self.backend_section,
Expand Down