Reading user input from console

17 views
Skip to first unread message

scru...@gmail.com

unread,
Aug 24, 2017, 1:57:18 PM8/24/17
to drake-workflow
Hello guys,

I really like the elegance and power of the Drake tool.
I wonder if there is a way to expect a user input (passwd, etc.).
In one step.

Thanks in advance.

Aaron Crow

unread,
Sep 8, 2017, 6:21:28 PM9/8/17
to scru...@gmail.com, drake-workflow
Hi, without knowing more about what you're trying to do, I'd suggest that you try to avoid expecting user input. It's often better to treat that as settings. For example, you can have settings files and the location of those files can be specified in your workflow as parameters to your scripts.

A common idiom for passwords (as well as other settings) is to put them in your environment and have your Drake script access them that way. E.g., on a bash shell you can do this...

export PASSWORD="our super secret password"

... and then your Drakefile can do something like this:

out.csv <- in.csv
  ruby myscript.rb --password $PASSWORD


I hope that helps. If not, please let us know more about the details of what you need to accomplish.




--
You received this message because you are subscribed to the Google Groups "drake-workflow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drake-workflow+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/drake-workflow.
For more options, visit https://groups.google.com/d/optout.

scru...@gmail.com

unread,
Sep 14, 2017, 3:15:00 PM9/14/17
to drake-workflow
Thanks for the reply Aaron. Is this the only way? I believe the password may be exposed. If I use the ps command I could see it, for example.



On Friday, September 8, 2017 at 7:21:28 PM UTC-3, Aaron Crow wrote:
> Hi, without knowing more about what you're trying to do, I'd suggest that you try to avoid expecting user input. It's often better to treat that as settings. For example, you can have settings files and the location of those files can be specified in your workflow as parameters to your scripts.
>
>
> A common idiom for passwords (as well as other settings) is to put them in your environment and have your Drake script access them that way. E.g., on a bash shell you can do this...
>
>
> export PASSWORD="our super secret password"
>
>
> ... and then your Drakefile can do something like this:
>
>
> out.csv <- in.csv
>   ruby myscript.rb --password $PASSWORD
>
>
>
>
> I hope that helps. If not, please let us know more about the details of what you need to accomplish.
>
>
>
>
>
>
> On Thu, Aug 24, 2017 at 10:57 AM, <scru...@gmail.com> wrote:
> Hello guys,
>
>
>
> I really like the elegance and power of the Drake tool.
>
> I wonder if there is a way to expect a user input (passwd, etc.).
>
> In one step.
>
>
>
> Thanks in advance.
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "drake-workflow" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to drake-workflo...@googlegroups.com.
>
> Visit this group at https://groups.google.com/group/drake-workflow.
>
> For more options, visit https://groups.google.com/d/optout.

Thanks for the reply Aaron. Is this the only way? I believe the password may be exposed. If I use the ps command I could see it, for example.

Aaron Crow

unread,
Sep 15, 2017, 9:38:58 PM9/15/17
to Sergio Cruz, drake-workflow
Ok, sure. Any script you run under Drake should be able to read CLI input normally. E.g., try this step:

out.txt <-
  echo "Speak your secret!"
  read password
  echo $password > $OUTPUT

To unsubscribe from this group and stop receiving emails from it, send an email to drake-workflow+unsubscribe@googlegroups.com.

scru...@gmail.com

unread,
Oct 5, 2017, 4:35:16 PM10/5/17
to drake-workflow
Thanks you Aaron. The problem was in a docker login usage.
Reply all
Reply to author
Forward
0 new messages