Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhandberg committed May 20, 2021
2 parents 62675ff + 8d4fb49 commit b9dd904
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
master-v0.6.1
master-v0.6.2
2 changes: 1 addition & 1 deletion flows/api/set_photometry_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def set_photometry_status(fileid, status):
"""
# Validate the input:
logger = logging.getLogger(__name__)
if status not in ('running', 'error', 'abort', 'done'):
if status not in ('running', 'error', 'abort', 'ingest', 'done'):
raise ValueError('Invalid status')

# Get API token from config file:
Expand Down
34 changes: 17 additions & 17 deletions flows/run_imagematch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Flows photometry code.
Expand All @@ -17,25 +17,25 @@
import re
from astropy.io import fits
from astropy.wcs.utils import proj_plane_pixel_area
from setuptools import Distribution
from setuptools.command.install import install
#from setuptools import Distribution
#from setuptools.command.install import install
from .load_image import load_image
from . import api

#--------------------------------------------------------------------------------------------------
class OnlyGetScriptPath(install):
def run(self):
# does not call install.run() by design
self.distribution.install_scripts = self.install_scripts

def get_setuptools_script_dir():
dist = Distribution({'cmdclass': {'install': OnlyGetScriptPath}})
dist.dry_run = True # not sure if necessary, but to be safe
dist.parse_config_files()
command = dist.get_command_obj('install')
command.ensure_finalized()
command.run()
return dist.install_scripts
#class OnlyGetScriptPath(install):
# def run(self):
# # does not call install.run() by design
# self.distribution.install_scripts = self.install_scripts

#def get_setuptools_script_dir():
# dist = Distribution({'cmdclass': {'install': OnlyGetScriptPath}})
# dist.dry_run = True # not sure if necessary, but to be safe
# dist.parse_config_files()
# command = dist.get_command_obj('install')
# command.ensure_finalized()
# command.run()
# return dist.install_scripts

#--------------------------------------------------------------------------------------------------
def run_imagematch(datafile, target=None, star_coord=None, fwhm=None, pixel_scale=None):
Expand Down Expand Up @@ -68,7 +68,7 @@ def run_imagematch(datafile, target=None, star_coord=None, fwhm=None, pixel_scal
# This is to avoid problems with it not being on the users PATH
# and if the user is using some other version of the python executable.
# TODO: There must be a better way of doing this!
imgmatch = os.path.join(get_setuptools_script_dir(), 'ImageMatch')
#imgmatch = os.path.join(get_setuptools_script_dir(), 'ImageMatch')
if os.name == "nt":
out = subprocess.check_output(["where", "ImageMatch"], universal_newlines=True)
imgmatch = out.strip()
Expand Down
3 changes: 3 additions & 0 deletions run_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@ def ingest_photometry_from_inbox():
latest_version=%(latest_version)s
WHERE fileid_img=%(fileid_img)s;""", phot_summary)

# Update the photometry status to done:
db.cursor.execute("UPDATE flows.photometry_status SET status='done' WHERE fileid=%(fileid_img)s AND status='ingest';", phot_summary)

if uploadlogid:
db.cursor.execute("UPDATE flows.uploadlog SET fileid=%s,status='ok' WHERE logid=%s;", [fileid, uploadlogid])

Expand Down
2 changes: 1 addition & 1 deletion run_photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def process_fileid(fid, output_folder_root=None, attempt_imagematch=True, autoup
if photfile is not None:
if autoupload:
api.upload_photometry(fid, delete_completed=True)
api.set_photometry_status(fid, 'done')
api.set_photometry_status(fid, 'ingest')

return photfile

Expand Down

0 comments on commit b9dd904

Please sign in to comment.