Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Increase stdout from setup/configure? #38

Closed
mnlevy1981 opened this issue Sep 3, 2019 · 16 comments · Fixed by #40
Closed

Increase stdout from setup/configure? #38

mnlevy1981 opened this issue Sep 3, 2019 · 16 comments · Fixed by #40

Comments

@mnlevy1981
Copy link
Contributor

I got a new laptop and after a week of use realized I still needed to install jupyter... I figured I'd go ahead and set up the recommended analysis environment as well. Per the README, I ran ./setup/configure and things seem to be stalled at

$ ./setup/configure
************** Found an existing Conda installation in: /Users/mlevy/miniconda3/bin/conda **************
***************** Skipping Conda installation... *****************
************** Creating/Updating conda environments (this can take 5-10 min) ***********

It's been 20+ minutes, and while I would not be surprised to learn that conda is doing something behind the screens, a little more information on how to track progress over this period of time would be nice. $ conda list isn't showing any updates to (base) yet, but something is happening to my environment:

$ conda list envs
# packages in environment at /Users/mlevy/miniconda3:
#
# Name                    Version                   Build  Channel

I'll continue to let the script run in the background, hopefully it'll finish eventually...

(Possibly related to #30?)

@mnlevy1981
Copy link
Contributor Author

I got impatient and ^Ced out. I don't know if the traceback is useful:

************** Creating/Updating conda environments (this can take 5-10 min) ***********
^CTraceback (most recent call last):
  File "./setup/configure", line 106, in <module>
    main()
  File "./setup/configure", line 102, in main
    prepare_env()
  File "./setup/configure", line 92, in prepare_env
    run_script(env_update_script, my_env)
  File "./setup/configure", line 33, in run_script
    out, err = process_output.communicate()
  File "/Users/mlevy/miniconda3/lib/python3.7/subprocess.py", line 939, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/Users/mlevy/miniconda3/lib/python3.7/subprocess.py", line 1681, in _communicate
    ready = selector.select(timeout)
  File "/Users/mlevy/miniconda3/lib/python3.7/selectors.py", line 415, in select
    fd_event_list = self._selector.poll(timeout)
KeyboardInterrupt

I'm trying the command one more time -- if this doesn't work, I might blow away my conda installation and see what happens if setup/configure installs it for me.

@andersy005
Copy link
Contributor

andersy005 commented Sep 3, 2019

@mnlevy1981, thank you for reporting this issue.

It's been 20+ minutes, and while I would not be surprised to learn that conda is doing something behind the screens, a little more information on how to track progress over this period of time would be nice.

Since we are using subprocess, one solution is to split the bash scripts into smaller scripts. Hopefully, this will helps us to report back to the user every few minutes whenever each small task is done. What do yo think?

@andersy005
Copy link
Contributor

andersy005 commented Sep 3, 2019

@mnlevy1981,

Can you try running

conda env update -f ./setup/env-conda-base.yml
conda env update -f ./setup/env-analysis.yml

on their own and see what conda is doing?

@mnlevy1981
Copy link
Contributor Author

@andersy005

one solution is to split the bash scripts into smaller scripts. Hopefully, this will helps us reporting back to the user every few minutes whenever each small task is done.

That would be nice -- being able to see, for instance, if this was hanging in the conda update conda call or if it had moved on to updating base or creating analysis or whatever. If possible, could be also have timestamps when each of these processes end? Something like

(12:07:55) Updating conda to latest version
(12:09:12) Adding packages to (base) environment

(I'm sure there's a better format than above, but that's the level of information I'd find helpful).

Also, does it make sense to offer a step-by-step approach in the README if the configure script fails or if users just want a little more detail in exactly what they are doing? For that, I'm picturing something like

Can you try running

conda env update -f ./setup/env-conda-base.yml
conda env update -f ./setup/env-analysis.yml

on their own and see what conda is doing?

Like you just suggested. I'll do that now and let you know.

@mnlevy1981
Copy link
Contributor Author

Verifying I was able to update base and create analysis using the provided yml files, so it's unclear to me why configure was hanging where it was

@andersy005
Copy link
Contributor

Glad to hear that individual steps work. Remember to run the post build script too:

./setup/post_build

@mnlevy1981
Copy link
Contributor Author

post_build is failing:

+ jupyter labextension install @jupyter-widgets/jupyterlab-manager @pyviz/jupyterlab_pyviz nbdime-jupyterlab jupyter-leaflet
Building jupyterlab assets (build:prod:minimize)
+ jupyter labextension update --all
Extension 'nbdime-jupyterlab' already up to date
Extension '@pyviz/jupyterlab_pyviz' already up to date
Extension '@jupyter-widgets/jupyterlab-manager' already up to date
Extension 'jupyter-leaflet' already up to date
++ ls -A /Users/mlevy/.local/share/cartopy
ls: /Users/mlevy/.local/share/cartopy: No such file or directory
+ '[' '' ']'
+ python --output /Users/mlevy/.local/share/cartopy cultural-extra cultural gshhs physical
unknown option --output
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

@andersy005
Copy link
Contributor

That is interesting! Does /Users/mlevy/.local/share/ directory exist?

@mnlevy1981
Copy link
Contributor Author

Nope! Not even ~/.local itself:

$ ls /Users/mlevy/.local
ls: /Users/mlevy/.local: No such file or directory

@andersy005
Copy link
Contributor

andersy005 commented Sep 3, 2019

I see... We need to make sure that that directory exists and if doesn't, we should create it in the post build scripts..

When you get time, can you take a look at https://circleci.com/gh/NCAR/ncar-python-tutorial/76 and let me know what you thing in terms of the stdout info.

@mnlevy1981
Copy link
Contributor Author

Making the directory doesn't seem to matter much, the error is still from the --output option (the ls results look the same)

++ ls -A /Users/mlevy/.local/share/cartopy
+ '[' '' ']'
+ python --output /Users/mlevy/.local/share/cartopy cultural-extra cultural gshhs physical
unknown option --output
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

Unless cartopy is supposed to be a python script created by one of the earlier scripts? I tried creating ~/.local/ and post_build failed as in #38 (comment), so I created ~/.local/share/ and it failed in the same way so I created ~/.local/share/cartopy/ and it returned the above error. Note that the only difference is the missing ls: /Users/mlevy/.local/share/cartopy: No such file or directory line (I think)


When you get time, can you take a look at https://circleci.com/gh/NCAR/ncar-python-tutorial/76 and let me know what you thing in terms of the stdout info.

It looks like you're still tweaking things, but a couple of comments based on the output

************* Step 1/5: Installing Miniconda  *****************
************* Step 2/5: Updating `base` conda environment *******************
************* Step 3/5: Creating/Updating `analysis` conda environment (this can take 5-10 min) ***********
************* Step 4/5: Running post build script for `base` environment **************
************* Step 5/5: Running post build script for `analysis` environment ***************
************* Setup completed successfully. ****************

This is certainly more informative than the previous output, though I still think it would be useful to append a time stamp to each step so that users can track how long it's actually been. I'd like

************* Step 1/5: Installing Miniconda  (HH:MM:SS) *****************

but could see an argument for

************* Step 1/5: Installing Miniconda  (MMM DD YYYY HH:MM:SS) *****************

Also, it's still just two big steps:

  1. Install Miniconda
  2. Set up environments for this tutorial

So I was picturing

************* Step 1/2: Installing Miniconda (HH:MM:SS) *****************
************** Step 2/2: Creating/Updating conda environments (this can take 5-10 min) (HH:MM:SS) ***********
************* Step 2a: Updating `base` conda environment (HH:MM:SS) *******************
************* Step 2b: Creating/Updating `analysis` conda environment (HH:MM:SS) ***********
************* Step 2c: Running post build script for `base` environment (HH:MM:SS) **************
************* Step 2d: Running post build script for `analysis` environment (HH:MM:SS) ***************
************* Setup completed successfully. (HH:MM:SS) ****************

(That's not a big deal if the bookkeeping is easier to just let each script be its own step.)

@andersy005
Copy link
Contributor

Looking at this a bit more

python --output /Users/mlevy/.local/share/cartopy cultural-extra cultural gshhs physical

It appears the setup/download_cartopy_assets.py script is not being passed to Python

python $CARTOPY_ASSET_SCRIPT --output ~/.local/share/cartopy cultural-extra cultural gshhs physical

I am going to investigate why $CARTOPY_ASSET_SCRIPT is null.

@andersy005
Copy link
Contributor

@mnlevy1981

I am going to investigate why $CARTOPY_ASSET_SCRIPT is null.

I know why this is happening. $CARTOPY_ASSET_SCRIPT is set in configure script, and running the post build script on its own should fail since this variable doesn't exist outside of the subprocess called process.

Try running the original

./setup/configure

@andersy005
Copy link
Contributor

This is certainly more informative than the previous output, though I still think it would be useful to append a time stamp to each step so that users can track how long it's actually been. I'd like

👍

I just added this in #40

@andersy005
Copy link
Contributor

andersy005 commented Sep 3, 2019

The latest version stdout:

****** Step 1/5: Installing Miniconda (20:10:31) ******
****** Step 2/5: Updating `base` environment (20:10:36) ******
****** Step 3/5: Creating/Updating `analysis` environment (this can take 5-10 min) (20:12:01) ******
****** Step 4/5: Running post build script for `base` environment (20:15:39) ******
****** Step 5/5: Running post build script for `analysis` environment (20:17:16) ******
****** Setup completed successfully. (20:20:52) ******
==> For changes to take effect, close and re-open your current shell. <==

@mnlevy1981, let me know if you give #40 the green light, and I will merge it.

@mnlevy1981
Copy link
Contributor Author

@mnlevy1981

I am going to investigate why $CARTOPY_ASSET_SCRIPT is null.

I know why this is happening. $CARTOPY_ASSET_SCRIPT is set in configure script, and running the post build script on its own should fail since this variable doesn't exist outside of the subprocess called process.

Try running the original

./setup/configure

This worked, thanks! I'm not sure why setup/configure worked after I created the environments by hand either, but I'll take it.

(I responded to your comments about the PR itself in #40 -- off to a meeting now, but will try to finalize review before I leave for the night. Thanks for taking this on!)

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

Successfully merging a pull request may close this issue.

2 participants