BibSched: bibupload max_priority check

* Optimises check for bibupload task priority normalization, avoiding
  useless SQL UPDATE statements in case normalization is not needed.

Reported-by: Ferran Jorba <Ferran.Jorba@uab.cat>
Co-authored-by: Tibor Simko <tibor.simko@cern.ch>
Merge branch 'maint-1.1'

* maint-1.1:
  BibSched: bibupload max_priority check
BibSched: fixes for multi-node setup

* Kwalitee improvements in bibsched.py.

* Updates the check for the maximum number of running tasks
  in order to only count tasks running on the current node.
  (closes #925)

Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
BibSched: fixes monotasks for multi-node

* In the scheduler we iterate over tasks that can run and
  execute some actions.
  In a multinode setup, monotasks that can run only on one
  node still need to trigger all tasks on all nodes to sleep.
  This patch checks for each task, if it needs to be put to sleep,
  in order to run a monotask on another node.
  (addresses #1304)

Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
BibSched: fixes task chain-sleeping

* In a multinode setup, if there was a monotask scheduled,
  the scheduler was trying to sleep all tasks at every cycle.
  This patch makes sure we only asks once for the tasks to sleep.
  (closes #1304)

Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
BibSched: scheduling algorithm improvements

* Correctly rebuild tasks view when some priorities or runtimes
  are adjusted in a sequenceid set.

* Clearly consider any other task in a sequenceid set when deciding
  whether to start a given task. (closes #1281)

* Optimizes waking-up decisions by not waking up tasks when there are
  other tasks about to go to sleep, since these usually means there
  is some higher priority task incoming, and the current task that could
  be waked up would steal their slot (while immediately be put to sleep
  on the next bibsched iteration).
BibSched: single error reporting

* When using bibsched multinode, each bibsched daemon would report
  errors. This patch checks that we are reporting errors once only.
  (closes #1342)

Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
BibSched: shell output leakage upon task kill

* When we are killing a task the shell is outputting
    /bin/sh foobar. killed
  The result is that the ncurses window becomes messy.
  This patch addresses the issue.
  (closes #1343)

Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
BibSched: kwalitee fixes

* Generally improves code kwalitee.

* Fixes wrong number of parameters in function call.

Co-authored-by: Samuele Kaplun <samuele.kaplun@cern.ch>
BibSched: CLI-started tasks host field

* Tasks that are started via the CLI using <task name> <task id>
  are now setting the host field properly.

Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
BibSched: priority in automatic mode

* Allows to change the task priority even when the
  BibSched monitor is running in automatic mode.

Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
BibSched: interface responsiveness improvements

* Forces refresh of rows after doing actions that modify
  them (e.g. deleting a task, changing priority on a task)
  instead of waiting for the first refresh.
  (closes #1303)

Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
BibSched: problem parsing task CLI options

* Fixes an issue introduced in 9369361849c6a21fec164fb10abb999ebc3e3748
  that caused certain CLI arguments (like -l) to be mismatched due to
  comparison against a string instead of a tuple of strings. (fixes #1330)

Reviewed-by: Samuele Kaplun <samuele.kaplun@cern.ch>
InvenioConnector: mechanize dependency

* python-mechanize package is an optional Invenio dependency.
  However _SGMLParserFactory and CDSInvenioConnector classes
  in invenio_connector.py were assuming its existence.
  This is now fixed.

Reported-by: Genis Musulmanbekov <genis@jinr.ru>
Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
BibCirculation: personid CERN attribute

* Fixes retrieval of personid CERN attribute from the user settings after
  changing introduced in the Shibboleth CERN authentication plugin in
  6d3f354cdf3ea39967ad830a5d421b855cde48db.

Reviewed-by: Jerome Caffaro <jerome.caffaro@cern.ch>
WebBasket: fix copying external items

* Fixes the copy of external items on basket
  created on the fly during the copy.

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
WebBasket: correct referer when adding to basket

* Fixes the handling of the referer when adding to basket and creating
  a new basket on the fly.  (closes #1194)

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
* BibIndex: new exacttitle index

* New `exacttitle` index that does not use stemming.  Useful for
  dupe matching purposes.  (closes #1397)

Co-authored-by: Tibor Simko <tibor.simko@cern.ch>
BibIndex: better wording for stemming in admin UI

* Improves the wording of the configuration form for the stemming
  setting, in order to better clarify how the system is affected
  by changing the stemming setting of an index.

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
Merge branch 'maint-0.99' into maint-1.0

* maint-0.99:
  BibIndex: better wording for stemming in admin UI