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

Problems updating scripts #163

Closed
jschultz opened this issue Nov 29, 2016 · 9 comments
Closed

Problems updating scripts #163

jschultz opened this issue Nov 29, 2016 · 9 comments
Milestone

Comments

@jschultz
Copy link

Hello,

I have seen a variety of problems appear with the arguments following an update of a script. Sorry for the vagueness of these descriptions, but I've found it hard to replicate the problem in a reliable way, although I'd say that at least one of the symptoms below appears more often than not:

  1. Repeated 'Optional Arguments' tabs on the script launch page. This isn't too bad as the script still seems to work.
  2. Missing tabs (I've seen missing 'Required' and 'Positional' tabs).
  3. Some of the arguments missing, ie instead of ~10 optional arguments I only see around 3.
  4. Suppressed arguments don't get suppressed, but appear with the help text '==SUPPRESS=='

This seems to happen whether I update the script via the web interface or the GUI. One curious thing that seems to make a difference is to use the GUI to delete all prior versions of a script.

As far as any peculiarities of my setup that might be making a difference go, I am using a non-default script group, and my scripts all contain all three of required, optional and positional arguments.

Many thanks for any assistance!

@Chris7
Copy link
Member

Chris7 commented Nov 30, 2016

Hi @jschultz,

Could you please send me an example script that illustrates these problems and provide the output of pip freeze?

@jschultz
Copy link
Author

jschultz commented Dec 1, 2016

Thanks for the reply. Here are links to a script and the output from pip freeze:
RQDA2NVPX.py
pip-freeze.txt

@Chris7
Copy link
Member

Chris7 commented Dec 2, 2016

So I looked at it and a few notes -- somethings that could use some sprucing up in the documentation:

For point 3): To suppress arguments, the use of argparse.SUPPRESS is there to hide the argparse related arguments. If you want to suppress these in Wooey, you need to do so through the admin interface (admin/wooey/scriptparameter/) where there is a 'hidden' checkbox (or do what argparse does, and set SUPPRESS to the default argument).

For point 1) -- this is definitely a bug and thanks for sending me your script -- it reproduces easily and I put in a fix.

For point 2/3 -- could I get a screen shot? I have never encountered this.

@jschultz
Copy link
Author

jschultz commented Dec 6, 2016

OK after a little experimentation I've managed to replicate 3 - hoping this is sufficient. If I begin with the same script I linked to before RQDA2NVPX.py, add it using the command line:

./manage.py addscript ~/src/nvivotools/RQDA2NVPX_copy.py

then go and add a new argument in the script before the existing arguments, for instance:

parser.add_argument('-bo', '--bogus', type=int, default=1)

then update the script:

./manage.py addscript --update ~/src/nvivotools/RQDA2NVPX_copy.py

From the script browser I now see (notice only one optional argument):

screenshot_20161206_155102

@Chris7
Copy link
Member

Chris7 commented Dec 8, 2016

Thank you, I'm busy for the next few days but hope to get this fixed and in a pypi release soon.

@Chris7
Copy link
Member

Chris7 commented Dec 19, 2016

I believe these are all resolved on latest master.

@Chris7 Chris7 closed this as completed Dec 19, 2016
@Chris7
Copy link
Member

Chris7 commented Jan 1, 2017

Fixed in latest release

@jschultz
Copy link
Author

jschultz commented Jan 4, 2017

Many thanks. For the record, could you outline the procedure to install the update on a running wooey installation. That is, do I need to re-bootstrap and if so, can the installed scripts be migrated to the new instance, or can the update be applied in situ?

@Chris7
Copy link
Member

Chris7 commented Jan 7, 2017

You would do this:

  1. Upgrade the version of wooey installed via pip
  2. Since this update actually changed wooey_settings.py, you would need to update this by changing wooey_settings.py in your project to:
from .django_settings import *
from wooey.version import DJANGO_VERSION, DJ17
from django.utils.translation import ugettext_lazy as _

INSTALLED_APPS += (
    # 'corsheaders',
    'wooey',
)

LANGUAGES = [
  ('de', _('German')),
  ('en', _('English')),
  ('fr', _('French')),
  ('ja', _('Japanese')),
  ('nl', _('Dutch')),
  ('zh-hans' if DJANGO_VERSION >= DJ17 else 'zh-cn', _('Simplified Chinese')),
]

NEW_MIDDLEWARE = []
for i in MIDDLEWARE_CLASSES:
    NEW_MIDDLEWARE.append(i)
    if i == 'django.contrib.sessions.middleware.SessionMiddleware':
        NEW_MIDDLEWARE.append('django.middleware.locale.LocaleMiddleware')

NEW_MIDDLEWARE.append('{{ project_name }}.middleware.ProcessExceptionMiddleware')
MIDDLEWARE_CLASSES = NEW_MIDDLEWARE

PROJECT_NAME = "{{ project_name }}"
WOOEY_CELERY_APP_NAME = 'wooey.celery'
WOOEY_CELERY_TASKS = 'wooey.tasks'

Note that you need to change {{ project_name }} to whatever your project is called. I'm going to make a management script to help with this in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants