Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-16333: Add Job metadata to the ap job. #54

Merged
merged 3 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions python/lsst/ap/verify/pipeline_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@
from lsst.verify import Job


# borrowed from validate_drp
def _extract_instrument_from_butler(butler):
SimonKrughoff marked this conversation as resolved.
Show resolved Hide resolved
"""Extract the last part of the mapper name from a Butler repo.
'lsst.obs.lsstSim.lsstSimMapper.LsstSimMapper' -> 'LSSTSIM'
'lsst.obs.cfht.megacamMapper.MegacamMapper' -> 'CFHT'
'lsst.obs.decam.decamMapper.DecamMapper' -> 'DECAM'
'lsst.obs.hsc.hscMapper.HscMapper' -> 'HSC'
"""
camera = butler.get('camera')
instrument = camera.getName()
return instrument.upper()


class ApPipeParser(argparse.ArgumentParser):
"""An argument parser for data needed by ``ap_pipe`` activities.

Expand Down Expand Up @@ -125,6 +138,12 @@ def runApPipe(metricsJob, workspace, parsedCmdLine):
log = lsst.log.Log.getLogger('ap.verify.pipeline_driver.runApPipe')

dataId = _parseDataId(parsedCmdLine.dataId)
# After processes are implemented, remove the flake exception
processes = parsedCmdLine.processes # noqa: F841
SimonKrughoff marked this conversation as resolved.
Show resolved Hide resolved

# Insert job metadata including dataId
metricsJob.meta.update({'instrument': _extract_instrument_from_butler(workspace.workButler)})
metricsJob.meta.update(dataId)
SimonKrughoff marked this conversation as resolved.
Show resolved Hide resolved

pipeline = apPipe.ApPipeTask(workspace.workButler, config=_getConfig(workspace))
try:
Expand Down
1 change: 1 addition & 0 deletions ups/ap_verify.table
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ setupRequired(ip_isr)
setupRequired(pipe_tasks)
setupRequired(verify)
setupRequired(ap_pipe)
setupRequired(ap_association)

setupOptional(ap_verify_testdata)
setupOptional(obs_test)
Expand Down