Coder Social home page Coder Social logo

Comments (4)

aliasguru avatar aliasguru commented on July 30, 2024 1

Tested it right now, works perfectly!

Open your .brenda.conf, and add a section like this at the end:

# CUSTOM VAR section
# add commands to be executed before rendering here
STARTUP_PRERUN=export BLENDER_USER_CONFIG=/path/you/want/;export BLENDER_USER_SCRIPTS=/path/you/need/;export OCIO=/guess/what/config.ocio

Separate all vars and commands with a semicolon as indicated above. I guess things like this would work as well (but have not tested it):

# CUSTOM VAR section
# add commands to be executed before rendering here
STARTUP_PRERUN=sudo ln -s /mnt/brenda/log /home/ubuntu/log

This would for example re-enable the ability to simply execute brenda-tool ssh tail log again (which atm doesn't work)

from brenda.

aliasguru avatar aliasguru commented on July 30, 2024

The AMI is based on Ubuntu 16.04.2, Blender is version 2.79.

from brenda.

tuttlen avatar tuttlen commented on July 30, 2024

from brenda.

aliasguru avatar aliasguru commented on July 30, 2024

I've modified the brenda source code to inject a few echos and system commands. The script sent to the server now looks like this:

----------------------------
AMI ID: ami-xxxxxxxxx
Max bid price 0.06
Request type: one-time
Instance type: c4.xlarge
Instance count: 1
Instance store device: /dev/sdb
SSH key name: xxxxxxxxxxxxxxxx
Security groups: ('brenda-web',)
Startup Script:
   #!/bin/bash
   echo user
   echo ----
   whoami
   echo current location
   echo ----------------
   pwd
   echo environment variables:
   echo ----------------------
   printenv
   echo ----------------------
   # run Brenda on the EC2 instance store volume
   B="/mnt/brenda"
   if ! [ -d "$B" ]; then
     for f in brenda.pid log task_count task_last DONE ; do
       ln -s "$B/$f" "/home/ubuntu/$f"
     done
   fi
   export BRENDA_WORK_DIR="."
   # export BLENDER_USER_CONFIG=/CustomSoftware/xxx/
   # export BLENDER_USER_SCRIPTS=/CustomSoftware/yyy/
   # export OCIO=/CustomSoftware/filmic-blender/config.ocio
   mkdir -p "$B"
   cd "$B"
   echo user
   echo ----
   whoami
   echo current location
   echo ----------------
   pwd
   echo environment variables:
   echo ----------------------
   printenv
   echo ----------------------
   /usr/local/bin/brenda-node --daemon <<EOF
   AWS_ACCESS_KEY=[redacted]
   AWS_SECRET_KEY=[redacted]
   BLENDER_PROJECT=s3://bucketName/renderme.zip
   WORK_QUEUE=sqs://Kiska-Test
   RENDER_OUTPUT=s3://outBucketName
   DONE=shutdown
   echo user
   echo ----
   whoami
   echo current location
   echo ----------------
   pwd
   echo environment variables:
   echo ----------------------
   printenv
   echo ----------------------
   EOF

As you can see, I've commented out my own export commands, which allowed me to finally set those vars as I really need them. When I now retrieve the system log from that instance using the AWS console, I see that the commands are executed:

[   20.783797] cloud-init[1331]: user
[   20.786265] cloud-init[1331]: ----
[   20.796147] cloud-init[1331]: root
[   20.798499] cloud-init[1331]: current location
[   20.801062] cloud-init[1331]: ----------------
[   20.803646] cloud-init[1331]: /
[   20.805912] cloud-init[1331]: environment variables:
[   20.808564] cloud-init[1331]: ----------------------
[   20.811132] cloud-init[1331]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[   20.814566] cloud-init[1331]: PWD=/
[   20.816847] cloud-init[1331]: LANG=en_US.UTF-8
[   20.819416] cloud-init[1331]: SHLVL=1
[   20.821770] cloud-init[1331]: _=/usr/bin/printenv
[   20.824306] cloud-init[1331]: ----------------------
[   20.827020] cloud-init[1331]: user
[   20.829361] cloud-init[1331]: ----
[   20.831664] cloud-init[1331]: root
[   20.833954] cloud-init[1331]: current location
[   20.836465] cloud-init[1331]: ----------------
[   20.838914] cloud-init[1331]: /
[   20.841150] cloud-init[1331]: environment variables:
[   20.843732] cloud-init[1331]: ----------------------
[   20.846318] cloud-init[1331]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[   20.849641] cloud-init[1331]: PWD=/
[   20.851882] cloud-init[1331]: LANG=en_US.UTF-8
[   20.854362] cloud-init[1331]: SHLVL=1
[   20.856656] cloud-init[1331]: _=/usr/bin/printenv
[   20.859302] cloud-init[1331]: ----------------------
[   20.861906] cloud-init[1331]: ln: failed to create symbolic link '/home/ubuntu/log': File exists
[   20.865175] cloud-init[1331]: user
[   20.867372] cloud-init[1331]: ----
[   20.869637] cloud-init[1331]: root
[   20.871885] cloud-init[1331]: current location
[   20.874330] cloud-init[1331]: ----------------
[   20.876976] cloud-init[1331]: /mnt/brenda
[   20.879422] cloud-init[1331]: environment variables:
[   20.882121] cloud-init[1331]: ----------------------
[   20.884818] cloud-init[1331]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[   20.888208] cloud-init[1331]: PWD=/mnt/brenda
[   20.890816] cloud-init[1331]: LANG=en_US.UTF-8
[   20.893339] cloud-init[1331]: SHLVL=1
[   20.895659] cloud-init[1331]: BRENDA_WORK_DIR=.
[   20.898248] cloud-init[1331]: _=/usr/bin/printenv
[   20.900814] cloud-init[1331]: OLDPWD=/
[   20.903237] cloud-init[1331]: ----------------------

So, at all times, the user which runs the brenda commands is root, and the current location is / (which is odd, I'd have expected it to be /root). There is a symlink error, but that one is caused by myself, I had already created that one on the AMI. The error is harmless. The environment vars however are clearly the minimalistic ones, not the ones ssh gives me.

One hope I can see: While digging around, I noticed that the startup script actually looks for a key called STARTUP_PRERUN. I interpret this as someone (presumably James Yonan) giving us a possibility to inject own commands to the script, by placing them into .brenda.conf. That's what I'll try next. If it works, users are not obliged to change source code for defining own AMI vars.

from brenda.

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.