Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the Event to the Container #39

Closed
gmolto opened this issue May 29, 2017 · 3 comments
Closed

Pass the Event to the Container #39

gmolto opened this issue May 29, 2017 · 3 comments
Assignees
Milestone

Comments

@gmolto
Copy link
Member

gmolto commented May 29, 2017

The Lambda function receives an Event and Context object. At least the Event should be passed down to the running container to allow the following scenario:

  • A bunch of files are uploaded to an S3 bucket. Notifications are triggered and Lambda functions are invoked. The application in the running container receives the Event and processes the file.

Ideas for implementation. The SCAR supervisor Lambda function ...

  • stores the Event in /tmp//event.txt (to avoid collisions due to /tmp sharing)
  • passes an environment variable SCAR_EVENT_FILE to the running container pointing to that file
@alpegon alpegon self-assigned this May 30, 2017
@alpegon alpegon added this to the v0.0.1 milestone May 30, 2017
@alpegon
Copy link
Collaborator

alpegon commented May 30, 2017

Done in pull request #52.
An event.json file is created in a location based on the request_id:

  • /tmp/resquest_id/event.json

@gmolto
Copy link
Member Author

gmolto commented Jun 6, 2017

The request_id does not seem to be available as an environment variable in the container (say REQUEST_ID). This is necessary for scripts in the containers to know the location of the event file.

The current environment variables are:

FAKECHROOT=true
container_uuid=c264515d-e6ba-3b4e-aaf6-20e2d535ad03
FAKECHROOT_DIR_MAP=/tmp/udocker-150-92ebcd53-b0a5-3a65-8ecd-5338fbdeb2fe-passwd!/etc/passwd:/tmp/udocker-150-39f325ac-1c34-3868-888e-e5d580cc2276-group!/etc/group
USER=sbx_user1099
LD_LIBRARY_PATH=/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT//usr/lib:/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT//lib:/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT//usr/lib64:/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT//lib64:/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT//usr/lib/x86_64-linux-gnu:/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT//lib/x86_64-linux-gnu:/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT/lib/x86_64-linux-gnu:/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT/usr/lib/x86_64-linux-gnu:/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT/usr/lib/x86_64-linux-gnu/gconv:/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT/usr/lib/x86_64-linux-gnu/coreutils:.
SHLVL=0
container_ruser=sbx_user1099
HOME=/
PS1=c264515d[\\W]$
FAKECHROOT_VERSION=2.18.1
container_root=/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT
container_execmode=F1
container_names=lambda_cont
LOGNAME=sbx_user1099
_=/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT//lib64/ld-linux-x86-64.so.2
FAKECHROOT_BASE=/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT
USERNAME=sbx_user1099
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
FAKECHROOT_AF_UNIX_PATH=/tmp
LD_PRELOAD=/tmp/home/.udocker/lib/libfakechroot-x86_64.so
FAKECHROOT_EXCLUDE_PATH=/tmp:/dev:/proc
PWD=/
FAKECHROOT_ELFLOADER=/tmp/home/.udocker/containers/c264515d-e6ba-3b4e-aaf6-20e2d535ad03/ROOT//lib64/ld-linux-x86-64.so.2

@gmolto gmolto added the P1 label Jun 6, 2017
@alpegon
Copy link
Collaborator

alpegon commented Jun 6, 2017

Done in PR #79
If you do a printenv yo can see:

...
PS1=69ec2f6b[\W]$
container_uuid=69ec2f6b-5be4-3497-a78b-6adc824bf5d2
HOME=/
REQUEST_ID=a031e3dd-4aa6-11e7-afb4-e3c4cd0c509e
SHLVL=0
FAKECHROOT_AF_UNIX_PATH=/tmp
LOGNAME=sbx_user1132
...

@alpegon alpegon closed this as completed Jun 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants