Hi,
Currently, I have a small web server to which I pump traffic, and once this
crosses a threshold, I call the addInstances API for this job. Now, the job
will fail if the second instance of the job is scheduled on the same
machine in the cluster, as the port number is already in use.

What I was thinking to do is generate a random number (say, between
5000-6000) to bind to, which can avoid this clash. I currently pass the
port number as a static parameter using the --env docker flag.
A more complex use case is to add this dynamic port number to the EC2 load
balancer that I use for testing stuff when the job runs, and delete the
port when the job stops.

I was reading about Hooks (
http://aurora.apache.org/documentation/latest/hooks/), and this seems to be
the way to go, but can't get my head around it.
One thing is because the other documentation (
http://aurora.apache.org/documentation/latest/configuration-reference/) has
no reference to it.

I have added a enable_hooks=True in my .aurora and in the process of
defining my custom class with requisite hooks.

Questions:
Is it ok to write small pieces of code like random number generation, etc
in the DSL?
Does the hook code run in the slave or in aurora?
Are the imports restricted to the hooks? Like import logging, and import
aws.boto fails?
Where does the hooks = [] line go in the DSL - in the jobs=[] section?

Anything else that I need to know to get this done.
Thanks.

--
κρισhναν

Reply via email to