databio / bulker

Manager for multi-container computing environments
https://bulker.io
BSD 2-Clause "Simplified" License
24 stars 2 forks source link

inspect requires crate name #51

Closed stolarczyk closed 4 years ago

stolarczyk commented 4 years ago

based on the message below, crate inspecting should be possible in an active crate with no arg provided

databio/peppro|~$ bulker -V
bulker 0.5.0
databio/peppro|~$ bulker inspect
Bulker config: /Users/mstolarczyk/bulker_config.yaml
No active create. Inspect requires a provided crate, or a currently active create.
nsheff commented 4 years ago

yes, it should be... type echo $BULKERCRATE and what do you get?

nsheff commented 4 years ago

it works here:

 ba databio/peppro
Bulker config: /home/nsheff/pCloudSync/env/bulker_config/zither.yaml
Activating bulker crate: databio/peppro
databio/peppro|~$ bulker inspect
Bulker config: /home/nsheff/pCloudSync/env/bulker_config/zither.yaml
Bulker manifest: databio/peppro
Crate path: /home/nsheff/bulker_crates/databio/peppro/default
Available commands: ['cksum', 'paste', 'chmod', 'fastq_pair', 'arch', 'tail', 'unexpand', 'cutadapt', 'expr', 'rm', 'base32', 'python3', 'perl', 'runcon', 'timeout', 'samtools', 'nohup', 'rmdir', 'preseq', 'sleep', 'vdir', 'bowtie2', 'pigz', 'echo', 'base64', 'which', 'bash', 'shuf', 'stty', 'fastqc', 'cp', 'chgrp', 'ptx', 'mkfifo', 'seq', 'du', 'bigWigCat', 'logname', 'factor', 'fastp', 'dircolors', 'java', 'pwd', 'expand', 'sh', 'mkdir', 'whoami', 'R', 'tsort', 'users', 'fmt', 'truncate', 'csplit', 'uptime', 'tee', 'touch', 'false', 'od', 'mv', 'numfmt', 'seqtk', 'b2sum', 'groups', 'id', 'docker', 'seqkit', 'basename', 'cat', 'bedtools', 'nproc', 'unlink', 'md5sum', 'link', 'cut', 'pr', 'shred', 'flash', 'yes', 'lesspipe', 'dir', 'sha512sum', 'tr', 'split', 'hostname', 'Rscript', 'sha256sum', 'chown', 'tty', 'uname', 'pinky', 'grep', 'true', 'wc', 'printf', 'install', 'stdbuf', 'ln', 'mknod', 'df', 'comm', 'sha224sum', 'realpath', 'dd', 'pathchk', 'uniq', 'nl', 'test', 'ls', 'env', 'sha384sum', 'tac', 'fold', 'who', 'wigToBigWig', 'hostid', 'printenv', 'sha1sum', 'join', 'nice', 'stat', 'date', 'awk', 'sed', 'sum', 'sync', 'dirname', 'head', 'sort']
databio/peppro|~$ 
stolarczyk commented 4 years ago

I get nothing

databio/peppro|~/Uczelnia/UVA/code/peppro$ echo $BULKERCRATE

databio/peppro|~/Uczelnia/UVA/code/peppro$
nsheff commented 4 years ago

did you re-init?

stolarczyk commented 4 years ago

yes, I ran bulker init -c ...

nsheff commented 4 years ago

do you have these lines?

grep rcfile $BULKERCFG
  rcfile: templates/start.sh
  rcfile_strict: templates/start_strict.sh
stolarczyk commented 4 years ago
[mstolarczyk@MichalsMBP ~]: c bulker_config.yaml
bulker:
  volumes: ['$HOME']
  envvars: ['DISPLAY']
  registry_url: http://hub.bulker.io/
  shell_path: ${SHELL}
  shell_rc: ${HOME}/.bashrc
  rcfile: templates/start.sh
  rcfile_strict: templates/start_strict.sh
  default_crate_folder: ${HOME}/bulker_crates
  singularity_image_folder: ${HOME}/simages
  container_engine: docker
  default_namespace: bulker
  executable_template: templates/docker_executable.jinja2
  shell_template: templates/docker_shell.jinja2
  build_template: templates/docker_build.jinja2
  crates:
    databio:
      peppro:
        default: /Users/mstolarczyk/bulker_crates/databio/peppro/default
    bulker:
      alpine:
        default: /Users/mstolarczyk/bulker_crates/bulker/alpine/default
      coreutils:
        default: /Users/mstolarczyk/bulker_crates/bulker/coreutils/default
nsheff commented 4 years ago

what's your echo $SHELL ?

nsheff commented 4 years ago

Also this will help: bulker inspect --verbosity 5

stolarczyk commented 4 years ago
[mstolarczyk@MichalsMBP code]: bulker-activate databio/peppro
Bulker config: /Users/mstolarczyk/bulker_config.yaml
Activating bulker crate: databio/peppro
databio/peppro|~/Uczelnia/UVA/code$ echo $SHELL
/bin/bash
stolarczyk commented 4 years ago
databio/peppro|~/Uczelnia/UVA/code$ bulker inspect --verbosity 5
Bulker config: /Users/mstolarczyk/bulker_config.yaml
The requested remote manifest 'http://hub.bulker.io/bulker/5.yaml' is not found.
stolarczyk commented 4 years ago

maybe?

databio/peppro|~/Uczelnia/UVA/code$ bulker --verbosity 5 inspect
DEBU 16:29:36 | yacman:est:266 > Configured logger 'yacman' using logmuse v0.2.6 
DEBU 16:29:36 | logmuse:est:266 > Configured logger 'logmuse' using logmuse v0.2.6 
DEBU 16:29:36 | logmuse:bulker:731 > Command given: inspect 
DEBU 16:29:36 | yacman.yacman:yacman:445 > No local config file was provided 
DEBU 16:29:36 | yacman.yacman:yacman:450 > Checking for environment variable: BULKERCFG 
DEBU 16:29:36 | yacman.yacman:yacman:455 > Found config file in BULKERCFG: /Users/mstolarczyk/bulker_config.yaml 
DEBU 16:29:36 | logmuse:bulker:184 > Selected bulker config: /Users/mstolarczyk/bulker_config.yaml 
INFO 16:29:36 | logmuse:bulker:771 > Bulker config: /Users/mstolarczyk/bulker_config.yaml 
ERRO 16:29:36 | logmuse:bulker:870 > No active create. Inspect requires a provided crate, or a currently active create. 
nsheff commented 4 years ago

sorry I meant: bulker --verbosity 5 inspect

nsheff commented 4 years ago

if you use --strict does it work?

stolarczyk commented 4 years ago

no, still the same response

databio/peppro|~/Uczelnia/UVA/code/bulker$ bulker inspect --strict
Bulker config: /Users/mstolarczyk/bulker_config.yaml
No active create. Inspect requires a provided crate, or a currently active create.
nsheff commented 4 years ago

no, activate with strict. there is no bulker inspect strict.

stolarczyk commented 4 years ago

the command is not available then:

[mstolarczyk@MichalsMBP peppro](master): bulker-activate --strict databio/peppro
Bulker config: /Users/mstolarczyk/bulker_config.yaml
Activating bulker crate: databio/peppro (Strict)
databio/peppro|~/Uczelnia/UVA/code/peppro$ bulker inspect
-bash: bulker: command not found
databio/peppro|~/Uczelnia/UVA/code/peppro$ 

databio/peppro|~/Uczelnia/UVA/code/peppro$ echo $BULKERCRATE

databio/peppro|~/Uczelnia/UVA/code/peppro$
nsheff commented 4 years ago

I cannot explain it but your computer is not using the new environment that bulker populates in these lines:

https://github.com/databio/bulker/blob/bb6704cde110e44bf5fc212fd478736e672f8c6c/bulker/bulker.py#L560-L563

here it should run your shell in that new environment, which should then have those variables:

https://github.com/databio/bulker/blob/bb6704cde110e44bf5fc212fd478736e672f8c6c/bulker/bulker.py#L595

bulker inspect relies on the BULKERCRATE variable. So, that it's empty is why it is failing. But why is it empty?

Is there something in your bashrc that overrides these variables? No -- because then the strict mode should have populated BULKERCRATE.

nsheff commented 4 years ago

Ok, I figured it out. Duh! You're using bulker-activate.

In the new version I recommend no longer using the --echo approach. Try it with the normal bulker activate.

I have a new recommended way to do a shell function, read more here:

https://bulker.databio.org/en/dev/tips/
nsheff commented 4 years ago

my commit fixes it for the echo mode as well.

nsheff commented 4 years ago

The original purpose of the echo mode was to allow setting the prompt. I now use a different way to do it.

You can use this function instead, if you want to preserve history, which maintains the ability to exit out of the shell and go back to the parent shell.

ba() { history -a; bulker activate $@; history -r; }
stolarczyk commented 4 years ago

ba works. Thanks!