Giter VIP home page Giter VIP logo

Comments (9)

matt-long avatar matt-long commented on July 20, 2024

intake_esm already supports building collections out of the box:

col = open_esm_metadatastore(collection_input_definition)

The advantage of this script is that you can build collections in the background; I have a SLURM batch script, for instance, that wraps build_collection.py...and would like to check this in too.

I think I like having the capacity live here because I can update the repo and have a ready tool to update the collections I am using.

from intake-esm-datastore.

andersy005 avatar andersy005 commented on July 20, 2024

I'm thinking of something different..something along the lines of having setuptools copy the script to PATH and make it available for general use with:

build_collection collection-definitions/my-collection.yml --overwrite-existing

from intake-esm-datastore.

matt-long avatar matt-long commented on July 20, 2024

Ok, that works. Where on PATH?

from intake-esm-datastore.

andersy005 avatar andersy005 commented on July 20, 2024

Where on PATH?

In the same environment as intake-esm. For instance for conda, it will put it in the bin directory of the environment:

root@0a9165cd7ff7:/usr/local/envs/intake-esm-dev/bin# which intake-esm-builder 
/usr/local/envs/intake-esm-dev/bin/intake-esm-builder

from intake-esm-datastore.

matt-long avatar matt-long commented on July 20, 2024

Is there any way to ensure that the script is executed in the right environment? We probably can't assume conda, but it would be great if the shebang string could actually set the conda environment.

from intake-esm-datastore.

andersy005 avatar andersy005 commented on July 20, 2024

Is there any way to ensure that the script is executed in the right environment?

setuptools takes care of everything: https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation

and because of #! /usr/bin/env python shebang, the python used will correspond to whichever python environment is active when the script is invoked.

from intake-esm-datastore.

matt-long avatar matt-long commented on July 20, 2024

But I think that if a user runs the script from an environment that doesn't have intake_esm installed, the script will fail.

from intake-esm-datastore.

andersy005 avatar andersy005 commented on July 20, 2024

The intake-esm-builder command is exclusively available in an environment with intake-esm installed.

abanihi@casper01: /glade/work/abanihi/devel/ncar $ which intake-esm-builder
/glade/work/abanihi/softwares/miniconda3/envs/dev/bin/intake-esm-builder
abanihi@casper01: /glade/work/abanihi/devel/ncar $ which python
/glade/work/abanihi/softwares/miniconda3/envs/dev/bin/python
abanihi@casper01: /glade/work/abanihi/devel/ncar $ conda activate base
abanihi@casper01: /glade/work/abanihi/devel/ncar $ intake-esm-builder
bash: intake-esm-builder: command not found

As a result, if a user tries running the script from an environment that doesn't have intake_esm installed, the script will fail and this is what we want, right?

from intake-esm-datastore.

matt-long avatar matt-long commented on July 20, 2024

I just wish there was a way to designate the right environment within the script itself; the shebang string tells the shell with program to use...it doesn't seem completely inconceivable that it also communicates the environment.

from intake-esm-datastore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.