From ce590c1eb2e810b4980384332e873fe50382bf78 Mon Sep 17 00:00:00 2001 From: "nova @ broiler" Date: Fri, 22 Feb 2019 13:32:27 +0000 Subject: [PATCH] diagnose & fix problem with super-wide images --- net/api.py | 2 +- net/find.py | 5 +++++ net/process_submissions.py | 2 +- net/settings_common.py | 3 ++- net/settings_nova.py | 11 ++++++----- net/views/image.py | 16 ++++++++++++---- net/views/submission.py | 2 +- net/views/user.py | 2 +- net/wsgi.py | 2 +- 9 files changed, 30 insertions(+), 15 deletions(-) diff --git a/net/api.py b/net/api.py index 078552e96..6581f880b 100644 --- a/net/api.py +++ b/net/api.py @@ -25,7 +25,7 @@ from .api_util import * from .log import * from .tmpfile import * -import settings +import astrometry.net.settings # Content-type to return for JSON outputs. json_type = 'text/plain' # 'application/json' diff --git a/net/find.py b/net/find.py index ec60e45f9..990396153 100644 --- a/net/find.py +++ b/net/find.py @@ -178,6 +178,11 @@ def bounce_try_dojob(jobid): if opt.uimage: ui = UserImage.objects.all().get(id=opt.uimage) print('UserImage', ui) + im = ui.image + print('Image', im) + sub = ui.submission + print('Submission', sub) + print(sub.disk_file.get_path()) if opt.chown: user = User.objects.all().get(id=opt.chown) diff --git a/net/process_submissions.py b/net/process_submissions.py index a768ec2a2..6b2e9a044 100644 --- a/net/process_submissions.py +++ b/net/process_submissions.py @@ -385,6 +385,7 @@ def dojob(job, userimage, log=None, solve_command=None, solve_locally=None): ra, dec, radius = tan.get_center_radecradius() nside = anutil.healpix_nside_for_side_length_arcmin(radius*60) nside = int(2**round(math.log(nside, 2))) + nside = max(1, nside) healpix = anutil.radecdegtohealpix(ra, dec, nside) sky_location, created = SkyLocation.objects.get_or_create(nside=nside, healpix=healpix) log.msg('SkyLocation:', sky_location) @@ -685,7 +686,6 @@ def main(dojob_nthreads, dosub_nthreads, refresh_rate, max_sub_retries, dojob_pool = multiprocessing.Pool(processes=dojob_nthreads) if dosub_nthreads > 1: print('Processing submissions with %d threads' % dosub_nthreads) - #dojob_pool = multiprocessing.Pool(processes=dojob_nthreads) dosub_pool = multiprocessing.Pool(processes=dosub_nthreads) print('Refresh rate: %.1f seconds' % refresh_rate) diff --git a/net/settings_common.py b/net/settings_common.py index af548ab0e..137dea8f9 100644 --- a/net/settings_common.py +++ b/net/settings_common.py @@ -14,6 +14,7 @@ 'nova4.astrometry.net', 'nova5.astrometry.net', 'nova6.astrometry.net', + 'testserver', ] MULTI_HOSTS = [] @@ -216,7 +217,7 @@ 'django.contrib.messages.middleware.MessageMiddleware', ) -ROOT_URLCONF = 'urls' +ROOT_URLCONF = 'astrometry.net.urls' ALLOWED_INCLUDE_ROOTS = ( os.path.join(WEB_DIR, 'templates'), diff --git a/net/settings_nova.py b/net/settings_nova.py index e351e378d..187714ff1 100644 --- a/net/settings_nova.py +++ b/net/settings_nova.py @@ -2,12 +2,13 @@ sitename = 'nova' # settings_nova.py -from settings_common import * +from astrometry.net.settings_common import * -MULTI_HOSTS = ['nova3.astrometry.net', - 'nova4.astrometry.net', - 'nova5.astrometry.net', - 'nova6.astrometry.net',] +# MULTI_HOSTS = ['nova3.astrometry.net', +# 'nova4.astrometry.net', +# 'nova5.astrometry.net', +# 'nova6.astrometry.net',] +MULTI_HOSTS = [] # from settings_social import * # ENABLE_SOCIAL = True diff --git a/net/views/image.py b/net/views/image.py index 1f6d05a18..1d419dde6 100644 --- a/net/views/image.py +++ b/net/views/image.py @@ -1046,8 +1046,16 @@ def search(req): if __name__ == '__main__': - class Duck(object): - pass - req = Duck() - onthesky_image(req, zoom=0, calid=1) + # class Duck(object): + # pass + # req = Duck() + # onthesky_image(req, zoom=0, calid=1) + from django.test import Client + c = Client() + r = c.get('/user_images/2676353') + #print(r) + f = open('out.html', 'wb') + for x in r: + f.write(x) + f.close() diff --git a/net/views/submission.py b/net/views/submission.py index 4c12f31d8..653549e5c 100644 --- a/net/views/submission.py +++ b/net/views/submission.py @@ -15,7 +15,7 @@ from astrometry.net.models import * from astrometry.net import settings from astrometry.net.util import NoBulletsRadioSelect, HorizontalRadioSelect -from log import * +from astrometry.net.log import * from django import forms from django.forms.models import inlineformset_factory from django.http import HttpResponseRedirect diff --git a/net/views/user.py b/net/views/user.py index 2c0af0b1f..b7f24aede 100644 --- a/net/views/user.py +++ b/net/views/user.py @@ -15,7 +15,7 @@ from astrometry.net.models import * from astrometry.net import settings -from log import * +from astrometry.net.log import * from django import forms from django.http import HttpResponseRedirect diff --git a/net/wsgi.py b/net/wsgi.py index 51d33f74d..7b5ec1333 100644 --- a/net/wsgi.py +++ b/net/wsgi.py @@ -17,7 +17,7 @@ os.environ['PATH'] += ':/usr/local/netpbm/bin:%s/blind:%s/util' % (path,path) import logging -logfn = os.path.join(path, 'nova.log') +logfn = os.path.join(path, 'net', 'nova.log') print('Logging to', logfn, file=sys.stderr) logging.basicConfig(filename=logfn, level=logging.DEBUG)