Skip to content

Commit

Permalink
Merge branch 'collection-spent-time' of 'https://github.com/jjmerchan…
Browse files Browse the repository at this point in the history
  • Loading branch information
sduenas authored Jul 31, 2024
2 parents a73ef83 + f5a2602 commit 08073db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
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

0 comments on commit 08073db

Please sign in to comment.