Skip to content
Snippets Groups Projects

Rework loader instantiation logic according to loader core api

The new loader.core now passes all configuration through the constructor. So no more default configuration only constructor parameters.

Note that this also updated some docstrings and type along the way.

Related to swh-core#1410

Test Plan

tox (failing until swh.loader.core > 0.17 is released)


Migrated from D5075 (view on Phabricator)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
75 url,
76 origin_url=None,
77 visit_date=None,
78 destination_path=None,
79 swh_revision=None,
80 start_from_scratch=False,
67 storage: StorageInterface,
68 url: str,
69 origin_url: Optional[str] = None,
70 visit_date: Optional[str] = None,
71 destination_path: Optional[str] = None,
72 swh_revision: Optional[str] = None,
73 start_from_scratch: bool = False,
74 temp_directory: str = "/tmp",
75 debug: bool = False,
76 check_revision: int = 0,
  • would be simpler to use an int with a default value of 0 here

    The test if self.check_revision will still behave the same.

  • I should default to 1000 as before to avoid changing behavior.

    Nonetheless, ack on your suggestion.

    It's not clear why i used Optional here... Maybe because i was in bot mode :D

  • Please register or sign in to reply
  • 85 85 self.svn_url = url
    86 86 # origin url as unique identifier for origin in swh archive
    87 87 self.origin_url = origin_url if origin_url else self.svn_url
    88 self.debug = self.config["debug"]
    89 self.temp_directory = self.config["temp_directory"]
    88 self.debug = debug
    89 self.temp_directory = temp_directory
    90 90 self.done = False
    91 91 self.svnrepo = None
    92 92 # Revision check is configurable
    93 check_revision = self.config["check_revision"]
    94 if check_revision["status"]:
    95 self.check_revision = check_revision["limit"]
    96 else:
    97 self.check_revision = None
    93 self.check_revision = check_revision
  • Antoine Lambert mentioned in merge request !52 (closed)

    mentioned in merge request !52 (closed)

  • mentioned in merge request swh-loader-core!341 (closed)

  • Looks good to me !

  • Merge request was accepted

  • Antoine Lambert approved this merge request

    approved this merge request

  • Adapt according to review

  • Build is green

    Patch application report for D5075 (id=18210)

    Rebasing onto 71e3b447...

    Current branch diff-target is up to date.
    Changes applied before test
    commit 7476a936423ff78f5c81af4262d3e82350deb6f0
    Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
    Date:   Sun Feb 7 08:45:16 2021 +0100
    
        Rework loader instantiation logic according to loader core api
        
        Note that this also updated some docstrings and type along the way.
        
        Related to swh/devel/swh-core#1410

    See https://jenkins.softwareheritage.org/job/DLDSVN/job/tests-on-diff/120/ for more details.

  • 75 url,
    76 origin_url=None,
    77 visit_date=None,
    78 destination_path=None,
    79 swh_revision=None,
    80 start_from_scratch=False,
    67 storage: StorageInterface,
    68 url: str,
    69 origin_url: Optional[str] = None,
    70 visit_date: Optional[str] = None,
    71 destination_path: Optional[str] = None,
    72 swh_revision: Optional[str] = None,
    73 start_from_scratch: bool = False,
    74 temp_directory: str = "/tmp",
    75 debug: bool = False,
    76 check_revision: int = 0,
  • Set check_revision to 0

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading