pass arbitrary options to twistd through the "tahoe" command-line #1546

Closed
opened 2011-09-26 07:17:50 +00:00 by zooko · 4 comments

comment:81332 Brian suggested:

What if we accepted a syntax like "tahoe start DIR -- ARG1 ARG2" or "tahoe start -- ARG1 ARG2", and passed all the extra ARG1/ARG2 strings into twistd.run()? I'd really like if it we had a way to pass arbitrary twistd arguments, rather than having to hand-code support for each one.

[comment:81332](/tahoe-lafs/trac-2024-07-25/issues/1267#issuecomment-81332) Brian suggested: > What if we accepted a syntax like "`tahoe start DIR -- ARG1 ARG2`" or "`tahoe start -- ARG1 ARG2`", and passed all the extra ARG1/ARG2 strings into `twistd.run()`? I'd really like if it we had a way to pass arbitrary twistd arguments, rather than having to hand-code support for each one.
zooko added the
code-frontend-cli
major
enhancement
1.9.0a2
labels 2011-09-26 07:17:50 +00:00
zooko added this to the undecided milestone 2011-09-26 07:17:50 +00:00
tahoe-lafs modified the milestone from undecided to eventually 2011-10-03 19:51:32 +00:00
tahoe-lafs added
normal
and removed
major
labels 2012-03-29 19:27:42 +00:00
meskio commented 2013-08-07 13:00:04 +00:00
Owner

I'm having a look to this idea so I don't implement by hand the --pidfile for the ticket #2045. What I'm not sure is how to make it consistent with tahoe stop. I think tahoe stop should have a --pidfile option, but I'm not sure how. Maybe something like:

$ tahoe start . -- --pidfile /run/tahoe.pid
$ tahoe stop . --pidfile /run/tahoe.pid

To add '--' to the stop command I think will be confusing, because there is no call after it to twistd to pass the params. But to have it different syntax between start and stop don't looks good.

Any ideas?

I'm having a look to this idea so I don't implement by hand the --pidfile for the ticket #2045. What I'm not sure is how to make it consistent with tahoe stop. I think tahoe stop should have a --pidfile option, but I'm not sure how. Maybe something like: ``` $ tahoe start . -- --pidfile /run/tahoe.pid $ tahoe stop . --pidfile /run/tahoe.pid ``` To add '--' to the stop command I think will be confusing, because there is no call after it to twistd to pass the params. But to have it different syntax between start and stop don't looks good. Any ideas?
Owner

I think it's a bug for people who use tahoe to have to have any idea that it is built on twisted. That's just an implementation detail which should be changeable.

I'd like to see a configure-time set of switches that set --datadir and the other usual things that autoconf uses, and then for various files to go in the normal places relative to those switches. I'm a little fuzzy on the details but the point is that there are many programs out there which do 95% of what we need.

The one place tahoe is special is in having a huge data directory. But generally programs that do that express it in a configuration file. So perhaps distributions should patch the default file, which can be in ${PREFIX}/share/examples/tahoe/tahoe.cfg. Right now the config file is generated programmatically, which is awkward.

I think it's a bug for people who use tahoe to have to have any idea that it is built on twisted. That's just an implementation detail which should be changeable. I'd like to see a configure-time set of switches that set --datadir and the other usual things that autoconf uses, and then for various files to go in the normal places relative to those switches. I'm a little fuzzy on the details but the point is that there are many programs out there which do 95% of what we need. The one place tahoe is special is in having a huge data directory. But generally programs that do that express it in a configuration file. So perhaps distributions should patch the default file, which can be in ${PREFIX}/share/examples/tahoe/tahoe.cfg. Right now the config file is generated programmatically, which is awkward.
daira commented 2013-08-11 13:08:23 +00:00
Owner

Knowing that Tahoe nodes are implemented using twistd is actually rather useful for power users; it allows people who know Twisted to understand and tweak its behaviour more easily.

Knowing that Tahoe nodes are implemented using `twistd` is actually rather useful for power users; it allows people who know Twisted to understand and tweak its behaviour more easily.

This was implemented at some point.

$ tahoe run --help
Usage:  tahoe [global-options] run [options] [NODEDIR [twistd-options]]
(use 'tahoe --help' to view global options)

Options:
  -C, --basedir=  Specify which Tahoe base directory should be used. This has
                  the same effect as the global --node-directory option.
                  [default: '/home/exarkun/.tahoe']
      --help      Display this help and exit.
      --version

twistd-options:
  -b, --debug          Run the application in the Python Debugger (implies
                       nodaemon),         sending SIGUSR2 will drop into
                       debugger
      --chroot=        Chroot to a supplied directory before running
  -d, --rundir=        Change to a supplied directory before running [default:
                       .]
  -e, --encrypted      The specified tap/aos file is encrypted.
      --euid           Set only effective user-id rather than real user-id.
                       (This option has no effect unless the server is running
                       as root, in which case it means not to shed all
                       privileges after binding ports, retaining the option to
                       regain privileges in cases such as spawning processes.
                       Use with caution.)
  -f, --file=          read the given .tap file [default: twistd.tap]
  -g, --gid=           The gid to run as.  If not specified, the default gid
                       associated with the specified --uid is used.
      --help           Display this help and exit.
      --help-reactors  Display a list of possibly available reactor names.
  -l, --logfile=       log to a specified file, - for stdout
      --logger=        A fully-qualified name to a log observer factory to use
                       for the initial log observer.  Takes precedence over
                       --logfile and --syslog (when available).
  -n, --nodaemon       don't daemonize, don't use default umask of 0077
  -o, --no_save        do not save state on shutdown
      --originalname   Don't try to change the process name
  -p, --profile=       Run in profile mode, dumping results to specified file.
      --pidfile=       Name of the pidfile [default: twistd.pid]
      --prefix=        use the given prefix when syslogging [default: twisted]
      --profiler=      Name of the profiler to use (profile, cprofile).
                       [default: cprofile]
  -r, --reactor=       Which reactor to use (see --help-reactors for a list of
                       possibilities)
  -s, --source=        Read an application from a .tas file (AOT format).
      --savestats      save the Stats object rather than the text output of the
                       profiler.
      --spew           Print an insanely verbose log of everything that happens.
                       Useful when debugging freezes or locks in complex code.
      --syslog         Log to syslog, not to file
  -u, --uid=           The uid to run as.
      --umask=         The (octal) file creation mask to apply.
      --version        Print version information and exit.
  -y, --python=        read an application from within a Python file (implies
                       -o)

Note that if any twistd-options are used, NODEDIR must be specified explicitly
(not by default or using -C/--basedir or -d/--node-directory), and followed by
the twistd-options.
This was implemented at some point. ``` $ tahoe run --help Usage: tahoe [global-options] run [options] [NODEDIR [twistd-options]] (use 'tahoe --help' to view global options) Options: -C, --basedir= Specify which Tahoe base directory should be used. This has the same effect as the global --node-directory option. [default: '/home/exarkun/.tahoe'] --help Display this help and exit. --version twistd-options: -b, --debug Run the application in the Python Debugger (implies nodaemon), sending SIGUSR2 will drop into debugger --chroot= Chroot to a supplied directory before running -d, --rundir= Change to a supplied directory before running [default: .] -e, --encrypted The specified tap/aos file is encrypted. --euid Set only effective user-id rather than real user-id. (This option has no effect unless the server is running as root, in which case it means not to shed all privileges after binding ports, retaining the option to regain privileges in cases such as spawning processes. Use with caution.) -f, --file= read the given .tap file [default: twistd.tap] -g, --gid= The gid to run as. If not specified, the default gid associated with the specified --uid is used. --help Display this help and exit. --help-reactors Display a list of possibly available reactor names. -l, --logfile= log to a specified file, - for stdout --logger= A fully-qualified name to a log observer factory to use for the initial log observer. Takes precedence over --logfile and --syslog (when available). -n, --nodaemon don't daemonize, don't use default umask of 0077 -o, --no_save do not save state on shutdown --originalname Don't try to change the process name -p, --profile= Run in profile mode, dumping results to specified file. --pidfile= Name of the pidfile [default: twistd.pid] --prefix= use the given prefix when syslogging [default: twisted] --profiler= Name of the profiler to use (profile, cprofile). [default: cprofile] -r, --reactor= Which reactor to use (see --help-reactors for a list of possibilities) -s, --source= Read an application from a .tas file (AOT format). --savestats save the Stats object rather than the text output of the profiler. --spew Print an insanely verbose log of everything that happens. Useful when debugging freezes or locks in complex code. --syslog Log to syslog, not to file -u, --uid= The uid to run as. --umask= The (octal) file creation mask to apply. --version Print version information and exit. -y, --python= read an application from within a Python file (implies -o) Note that if any twistd-options are used, NODEDIR must be specified explicitly (not by default or using -C/--basedir or -d/--node-directory), and followed by the twistd-options. ```
exarkun added the
fixed
label 2020-01-16 20:15:03 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#1546
No description provided.