pacificclimate / modelmeta

An ORM representation of the model metadata database
GNU General Public License v3.0
1 stars 0 forks source link

Fix the package to install ncwms_configurator #83

Closed jameshiebert closed 4 years ago

jameshiebert commented 5 years ago

Resolves #82

We may want to also rebase this onto 0.2.0 and release it as 0.2.1 since our dbs still aren't migrated to the new schema.

jameshiebert commented 5 years ago

Tests are failing due to #80. Stand by.

corviday commented 5 years ago

I normally just install this package from Github when I want to use it, so I'm not sure how to invoke it in the newly possible way for testing.

$ git status
On branch feature/82
Your branch is up to date with 'origin/feature/82'.

$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -i https://pypi.pacificclimate.org/simple/ -r requirements.txt
$ pip install .

With the package installed, associate_ensemble behaves as I would expect it to:

$ associate_ensemble -h 
### Creating modelmeta ORM
usage: associate_ensemble [-h] -d DSN -n ENSEMBLE_NAME -v ENSEMBLE_VER
                          [-V VAR_NAMES] [-r]
                          filepaths [filepaths ...]

Associate an ensemble to datafiles

positional arguments:
  filepaths             Files to process

optional arguments:
  -h, --help            show this help message and exit
  -d DSN, --dsn DSN     DSN for metadata database
  -n ENSEMBLE_NAME, --ensemble-name ENSEMBLE_NAME
                        Name of ensemble
  -v ENSEMBLE_VER, --ensemble-ver ENSEMBLE_VER
                        Version of ensemble
  -V VAR_NAMES, --variables VAR_NAMES
                        Comma-separated list of names of variables to
                        associate (unspecified: all variables in file)
  -r, --regex-filepaths
                        Interpret filepaths as regular expressions. Associate
                        tovariables of files matching any of those regular
                        expressions.

But ncwms_configurator does not:

$ ncwms_configurator -h
import-im6.q16: not authorized `sys' @ error/constitute.c/WriteImage/1037.
import-im6.q16: not authorized `logging' @ error/constitute.c/WriteImage/1037.
from: can't read /var/mail/argparse
from: can't read /var/mail/ncwms_configurator
/home/lzeman/tmp/modelmeta/venv/bin/ncwms_configurator: line 10: syntax error near unexpected token `stream=sys.stdout,'
/home/lzeman/tmp/modelmeta/venv/bin/ncwms_configurator: line 10: `    logging.basicConfig(stream=sys.stdout, level=logging.INFO)'

I assume I am misunderstanding the goal of this PR.

jameshiebert commented 5 years ago

Ah, in your output the script is being interpreted by bash. My bad. Needed to prefix it with a shebang.