Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9339734
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
View Options
diff --git a/swh/lister/github/base.py b/swh/lister/github/base.py
index 15c2755..8484484 100644
--- a/swh/lister/github/base.py
+++ b/swh/lister/github/base.py
@@ -1,65 +1,65 @@
# Copyright (C) 2016 The Software Heritage developers
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from swh.core import config
from swh.storage import get_storage
from swh.scheduler.backend import SchedulerBackend
# TODO: split this into a lister-agnostic module
class SWHLister(config.SWHConfig):
CONFIG_BASE_FILENAME = None
DEFAULT_CONFIG = {
'storage': ('dict', {
'cls': 'remote',
'args': {
- 'url': 'http://localhost:5000/'
+ 'url': 'http://localhost:5002/'
},
}),
'scheduling_db': ('str', 'dbname=softwareheritage-scheduler'),
}
ADDITIONAL_CONFIG = {}
def __init__(self):
self.config = self.parse_config_file(
additional_configs=[self.ADDITIONAL_CONFIG])
self.storage = get_storage(**self.config['storage'])
self.scheduler = SchedulerBackend(
scheduling_db=self.config['scheduling_db'],
)
def create_origins(self, origins):
"""Create the origins listed, and return their ids.
Args:
origins: a list of origins
Returns:
a list of origin ids
"""
return self.storage.origin_add(origins)
def create_tasks(self, tasks):
"""Create the tasks specified, and return their ids.
Args:
tasks (list of dict): a list of task specifications:
type (str): the task type
arguments (dict): the arguments for the task runner
args (list of str): arguments
kwargs (dict str -> str): keyword arguments
next_run (datetime.datetime): when to schedule the next run
Returns:
a list of task ids
"""
returned_tasks = self.scheduler.create_tasks(tasks)
return [returned_task['id'] for returned_task in returned_tasks]
def disable_tasks(self, task_ids):
"""Disable the tasks identified by the given ids"""
self.scheduler.disable_tasks(task_ids)
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Jul 4 2025, 9:52 AM (5 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3281318
Attached To
rDLS Listers
Event Timeline
Log In to Comment