Skip to content

Instantly share code, notes, and snippets.

@wavewave
Created March 12, 2018 20:55
Show Gist options
  • Save wavewave/5d735ce1205a786dbcfd23b909734561 to your computer and use it in GitHub Desktop.
Save wavewave/5d735ce1205a786dbcfd23b909734561 to your computer and use it in GitHub Desktop.
Nix closure passing from local machine to cluster.
#!/bin/bash
cd /afs/cern.ch/work/i/ikim/public/heavyhiggs/lhc-analysis-collection/heavyhiggs
/afs/cern.ch/work/i/ikim/public/heavyhiggs/lhc-analysis-collection/heavyhiggs/optimize $1
nix-store --export $(nix-store -qR /nix/store/phsx93ayw4gr6j4r0j2mf7bjza0lzj1l-env-jobqueue-client-0.1.999) | bzip2 | cat > clusteregg.closure.bz2
#!/nix/store/8qhilznm4abzjvnbkqi48zy6wrljgi80-bash-4.2-p45/bin/bash
export PATH=/nix/store/h5bnjfh7l1q7cy8ry15fvmam5a40ij6c-coreutils-8.21/bin:/nix/store/krgdc4sknzpw8iyk9p20lhqfd52kjmg0-gnused-4.2.2/bin
mkdir $1
cd $1
/nix/store/phsx93ayw4gr6j4r0j2mf7bjza0lzj1l-env-jobqueue-client-0.1.999/bin/load-env-jobqueue-client-0.1.999 client.sh
#!/bin/bash
echo "test5-1"
export MYTEMP=${TMPDIR}/$1
echo "test5-2"
cd $MYTEMP/nixtemp
echo "test5-3"
/usr/bin/bzip2 -d -c /afs/cern.ch/work/i/ikim/nix-1.7-x86_64-linux.tar.bz2 | /bin/tar xvf -
echo "test5-4"
/bin/cp -a $MYTEMP/nixtemp/nix-1.7-x86_64-linux/store /nix/store
echo "test5-5"
/usr/bin/bzip2 -d -c /afs/cern.ch/work/i/ikim/optimize.closure.bz2 | /nix/store/clnpynyac3hx3a6z5lsy893p7b4rwnyf-nix-1.7/bin/nix-store --import
echo "test5-6"
cd $MYTEMP/nixtemp
echo "test5-7"
export WORKDIR=$MYTEMP/mc
echo "test5-8"
echo "$@"
echo "test5-9"
shift
echo "$@"
/nix/store/mlrzw70flr3wig9m60mjg8vw2csrkdix-optimize/bin/optimize.sh $@
#!/bin/bash
unset LD_LIBRARY_PATH
echo "test1"
echo $TMPDIR
#NEW_UUID=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 )
echo "test2"
[ -z "${LSB_JOBID}" ] && echo "NOw set LSB_JOBID=${NEW_UUID}" && LSB_JOBID=${NEW_UUID}
echo "test3"
mkdir -p ${TMPDIR}/${LSB_JOBID}/nixtest
echo "test4"
mkdir -p ${TMPDIR}/${LSB_JOBID}/nixtemp
echo "test5"
/afs/cern.ch/user/i/ikim/Downloads/proot-x86_64 -b ${TMPDIR}/${LSB_JOBID}/nixtest:/nix /afs/cern.ch/user/i/ikim/repo/srcp/nixscript/nixscript/nixinstall.sh ${LSB_JOBID} $@
echo "test6"
chmod -R u+w ${TMPDIR}/${LSB_JOBID}
echo "test7"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment