BHTOM-Team / bhtom2

7 stars 2 forks source link

TargetName: add new field to the model with url to the webpage with external info #90

Closed wyrzykow closed 1 year ago

wyrzykow commented 1 year ago

For example, OGLE_EWS name should be stored as short, 2016-BLG-1234. But there should be a link under that name to the URL in OGLE EWS, the URL should be set while setting aliases (in Create/Update or in hook). It would be useful for ASASSN, as there could be 3 different URLs types. Now we just store the full URL as the name - nasty!

wyrzykow commented 1 year ago

Does not work in production. The URL field is added ok, but the broker should use the URL to directly download the data from there.

wyrzykow commented 1 year ago

harvesters.database.targetName.py, line 25. def getTargetNameFromDB(target, sourceName): cur = None conn = None

try:
    conn = getBlackHoleTomDBConnect()
    cur = conn.cursor()
    cur.execute("""select name, source_name
                    from bhtom_targets_targetname
                    where target_id = %s and source_name = %s""", [str(target), str(sourceName)])
    row = cur.fetchone()
    assert row is not None
except psycopg2.Error as e:
    logger.error("Internal bhTomDb connection error - error: %s" % str(e))
    raise targetNameError(ErrorUtils.dbConnInternalError)
except AssertionError:
    return TargetName(None)
finally:
    cur.close()
    conn.close()

return TargetName(row)

-> should also return the URL.

And then in atlas broker - it should read the URL and read data from there.