Skip to content

Commit

Permalink
Merge 0519f92 into a595052
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlLevik committed Dec 2, 2019
2 parents a595052 + 0519f92 commit d017e93
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Expand Up @@ -17,14 +17,16 @@ addons:
mariadb: 10.3

before_install:
- wget https://github.com/DiamondLightSource/ispyb-database/releases/download/v1.8.0/ispyb-database-1.8.0.tar.gz
- tar xvfz ispyb-database-1.8.0.tar.gz
- wget https://github.com/DiamondLightSource/ispyb-database/releases/download/v1.9.1/ispyb-database-1.9.1.tar.gz
- tar xvfz ispyb-database-1.9.1.tar.gz
- mysql_upgrade -u root
- mysql -u root -e "CREATE DATABASE ispybtest; SET GLOBAL log_bin_trust_function_creators=ON;"
- mysql -u root -D ispybtest < schema/tables.sql
- mysql -u root -D ispybtest < schema/lookups.sql
- mysql -u root -D ispybtest < schema/data.sql
- mysql -u root -D ispybtest < schema/routines.sql
- mysql -u root -D ispybtest < grants/ispyb_processing.sql
- mysql -u root -e "CREATE USER ispyb_api@'localhost' IDENTIFIED BY 'password_1234'; GRANT ispyb_processing to ispyb_api@'localhost'; SET DEFAULT ROLE ispyb_processing FOR ispyb_api@'localhost';"

before_script:
- cp conf/config.example.cfg conf/config.cfg
Expand Down
4 changes: 2 additions & 2 deletions conf/config.example.cfg
@@ -1,7 +1,7 @@
# Copy this to config.cfg and modify it for your environment
[ispyb_mariadb_sp]
user = root
pw =
user = ispyb_api
pw = password_1234
host = localhost
port = 3306
db = ispybtest
Expand Down
15 changes: 15 additions & 0 deletions ispyb/sp/mxprocessing.py
Expand Up @@ -276,6 +276,21 @@ def upsert_program_attachment(self, values):
procname="upsert_processing_program_attachment_v2", args=values
)

def upsert_program_message(
self, id=None, program_id=None, severity=None, message=None, description=None
):
"""Store new or update existing program message params.
:param severity: ERROR,WARNING or INFO
:param message: The message - max 200 characters
:param description: A more detailed description of the message
:return: The program_message_id.
"""
return self.get_connection().call_sp_write(
procname="upsert_processing_program_message",
args=[id, program_id, severity, message, description],
)

def upsert_processing(self, values):
return self.get_connection().call_sp_write(
procname="upsert_processing", args=values
Expand Down
12 changes: 12 additions & 0 deletions tests/test_mxprocessing.py
Expand Up @@ -181,6 +181,18 @@ def test_processing2(testdb):
assert pa2[0]["filePath"] == params["file_path"]
assert pa2[0]["fileType"] == params["file_type"]

pmid = mxprocessing.upsert_program_message(
id=None,
program_id=programid,
severity="WARNING",
message="Missing images",
description="Images # 3, 14-27, 29, 37, 42, 59-63, 97, 118, 121 missing from data collection directory",
)
assert pmid is not None

pmid2 = mxprocessing.upsert_program_message(id=pmid, severity="ERROR")
assert pmid == pmid2

params = mxprocessing.get_integration_params()
params["datacollectionid"] = 993677
params["start_image_no"] = 1
Expand Down

0 comments on commit d017e93

Please sign in to comment.