Opened 3 years ago

Closed 3 years ago

#465 closed enhancement (fixed)

BibAuthorID: clean relative vs absolute imports

Reported by: simko Owned by: scarli
Priority: minor Milestone:
Component: BibAuthorID Version:
Keywords: Cc:

Description

Due to usage of relative imports, one cannot run unit test before
installing them, as is usual for other modules:

$ python ./bibauthorid_tests.py
Traceback (most recent call last):
  File "./bibauthorid_tests.py", line 21, in <module>
    import bibauthorid_tables_utils as baidtu
  File "/home/simko/private/src/invenio/modules/bibauthorid/lib/bibauthorid_tables_utils.py", line 30, in <module>
    from search_engine import get_record
ImportError: No module named search_engine

If relative imports are wanted e.g. to be able to run BibAuthorID on
grid node where Invenio is not installed, then it may be interesting
to introduce conditional imports that will attempt to import needed
modules from local scope and in case of ImportError from global scope,
kind of like:

try:
    from search_engine import get_record
except ImportError:
    from invenio.search_engine import get_record

Change History (3)

comment:1 Changed 3 years ago by scarli

  • Owner set to scarli
  • Status changed from new to assigned

comment:2 Changed 3 years ago by scarli

  • Status changed from assigned to in_merge

Non-Bibauthorid modules are now imported from the global scope in case the local import fails (not to affect grid-portability).

http://invenio-software.org/repo/personal/invenio-scarli/commit/?h=ticket-465-relative-imports-fix&id=0067a484705a362e5a71f8b9b4136df86b1418d3

comment:3 Changed 3 years ago by Henning Weiler <henning.weiler@…>

  • Resolution set to fixed
  • Status changed from in_merge to closed

In [0b3e81105a01b9775c032dc48d44c8ae6a52aa39]:

BibAuthorID: major update

  • Multiprocessing in Daemon
  • Made Daemon multi processing ready
  • Fixed: Name removal issue in queue population
  • Surname regexp updates
  • Introduced hack for last names w/ len < 2. These will now be matched differently, since it would load too many names into the cluster.
  • Caching introduced to speed up the pid update process. Bibref/Bibrec pair will be cached in VA entity
  • dbquery update to withstand multiprocessing db access
  • dbquery update to offer distinct feature to close db connection
  • Feature updates and bugfixes
  • Allows to configure bibauthorid to focus on one certain collections or all
  • Full unicode support
  • Support for Python module unidecode to auto-transliterate utf-8 encoded names.
  • Fix date conversion error for 0 date descriptions
  • Firefighting entries that are too long for the colum size. Truncation in effect accordingly.
  • Fix queue.remove incompatibility
  • Fix string partition on lastname only cases
  • Besides limiting to certain collections, now it's also possible to exclude collections entirely. HEPNames exclusion has been hard-coded so far and with new collections to disregard, this got moved in another, earlier, stage of the algorithm with new config options.
  • Save the session, save the world!!
  • ArXiv login procedures and welcome page
  • cmp arxiv user role defined
  • Rewritten UI from scratch
  • Various backend fixes
  • Rewritten internal authorization system
  • Claim/attribute others papers
  • RT ticketing support and management
  • ArXiv export according to RFC
  • Fixed relative vs. absolute imports ( fixes #465 )
  • New indexes in tables for more efficient queries
  • Make some config parameters user-modifiable ( fixes #468 )
    • Personid parameters are now in invenio.conf
      • Standalone mode checking not to fail imports
      • Pythonic arrays from csv in config file using convert_conf_option
  • UI updates and redesigns
  • Dictionaries to configure button and link texts
  • Extended Access and permission control
  • arXiv export
  • Indexing authorids requires to determine the ID of a given author on a given record. A function has been added to make this request possible.
  • The indexing function gets imported by search engine. Removed search engine imports from header and moved to function calls.
  • Person search with canonical names/ids
  • Unfortunately, the session blob field is limited to 64K of data. Due to the bibref list in paper listings, this could be exceeded in collaboration papers. Fixed.
  • Bibauthorid: Counter-act "too many connections" Upon updating personid from algorithm, it may happen that the sql connection count quota was exceeded when threads ended too fast. Introduced a new method in dbquery to force connections to close.
  • Tought new canonical name/id to diverse functions to accept is as an ID
  • Optional browser cache killer Adds a switch to optionally kill the browser's cache using the killer on the person page leads to unneccesssary longer loading times.
  • Config switches to enable/disable parts of the UI
  • Removed JSON import dependency ( fixes #512 )
  • I18n for user-facing strings ( fixes #467 )
  • Guest, User and Operator views for each "Claim Your Paper", "Choose Her Papers", "Person Manager"
  • New Icon Set
  • New Styles
  • jQuery 1.5 compatible
  • Enriched Demo Personas ( fixes #469 )

Co-authored-by: Carli Samuele <samuele.carli@…>

Note: See TracTickets for help on using tickets.