Summary: Until now we were running Edenfs on the console. Now we could use edenfsctl start.
Reviewed By: chadaustin
Differential Revision: D16565624
fbshipit-source-id: 9a12e52234d36d7b8ce4e3741ffb62655ae334b2
Summary: The Windows and Mac cli build scripts were not building the new fb303 thrift file. Also updated few cli code to use the new fb303 module.
Reviewed By: chadaustin
Differential Revision: D16508590
fbshipit-source-id: 386fa1bf77124d258ffb00edf56c9c827f32e795
Summary:
Enable the `edenfsctl debug` subcommands on Windows.
The `overlay` subcommand is the only debug subcommand that requires modules
not available on Windows. The overlay code uses the `fcntl` module for
locking the overlay. However, EdenFS on Windows does not use the overlay
directory structure used on Linux and Mac, so this subcommand isn't relevant
on Windows.
This moves the `overlay` subcommand to its own module, and changes the code to
avoid importing it on Windows. This lets us enable the rest of the debug
subcommands on Windows.
Reviewed By: pkaush
Differential Revision: D16354620
fbshipit-source-id: ee7ea01fa3a21018850f5ba590eb143d7a9718cf
Summary:
Centered clock between title and hostname
Removed bar
Defaulted update speed to 1s, with command line option to change
Gave more/less space to certain columns
Decreased padding to 1 character
Reviewed By: chadaustin
Differential Revision: D16195428
fbshipit-source-id: 6dbd6710727bcd3e65e87fc5bd269a39507dca9b
Summary:
I made the mistake of migrating the Thrift API for edenfs process
checks without a fallback for older edenfs running processes.
If getDaemonInfo() is not available, fall back on getPid().
Reviewed By: strager, pkaush
Differential Revision: D16365848
fbshipit-source-id: aee5c43c8c40db9a38fef7ca601f7639daa4adb8
Summary:
Open source fb303 will not have getPid() or getCommandLine(), so
introduce a new method for Eden's tests.
Reviewed By: fanzeyi
Differential Revision: D16292993
fbshipit-source-id: 5cdc006ec0ee15f50a3e1cebe9b46a3ea275ff78
Summary:
`eden top` used to refresh its data every 2 seconds, now process data accumulates and never leaves the screen (unless it is outdated and gets pushed off the screen by other processes).
For the old functionality, you can run `eden top -e` or `eden -top --ephemeral` which constantly refreshes the screen.
{F166770061}
Reviewed By: chadaustin
Differential Revision: D16157909
fbshipit-source-id: 5d739b4c92d1472337301f34dbf6b1f21e10b81b
Summary: Made a top class to better handle state within `eden top`. Right now, the only field is `running`, but later we will want to track the processes and rows.
Reviewed By: strager
Differential Revision: D16188183
fbshipit-source-id: 38e27dc87353f65212fcb47544707a8e34ba4c68
Summary: Taking out debug and rage (which internally imports debug) from Windows. To make debug comply it would take a bunch of ifs.
Reviewed By: strager
Differential Revision: D15997869
fbshipit-source-id: 1ce46c30d00201b351c8fe9100dcef5a490b5a6c
Summary:
This is part of the effort to make our bind-mount configuration more
visible and easier to change.
The idea is to generalize the concept of redirection and add a command to help
manage it.
The `eden redirect add` subcommand allows creating one of two different kinds
of redirection:
* `bind` - allocate some space using `mkscratch` and mount it into the repo
* `symlink` - allocate some space using `mkscratch` and create a symlink
that points to it from the repo
On Linux we use bind mounts to implement `bind` but on macOS, which doesn't
have a bind mount concept, we create a sparse disk image file that can grow
to match the size of the disk on which it is created (in practice these are a
7-15MB in size to start and grow as the user stores data into them).
The `eden redirect del` subcommand allows removing a redirection, including
the legacy `bind-mounts` configuration from `.eden/client/config.toml`.
The `eden redirect list` subcommand lists the effective set of redirections,
both from the new redirections configuration and the legacy `bind-mounts`
configuration, along with their state.
The `eden redirect fixup` subcommand iterates over the effective set of
redirections and can remove and reinstate any that are in a broken state.
Reviewed By: strager
Differential Revision: D15707319
fbshipit-source-id: a5dd8c44c9f748482d7b48855b1305d44267885c
Summary: We don't import fsck_mod on Windows. Hiding the fsck_mod.Error from python to make edenfsctl status work on Windows.
Reviewed By: strager
Differential Revision: D15912061
fbshipit-source-id: 918fd3cc5729b0c98b098de7c85bb340cdb1ca05
Summary:
Update the copyright & license headers in Python files to reflect the
relicensing to GPLv2
Reviewed By: wez
Differential Revision: D15487088
fbshipit-source-id: 9f2138dff41048d2c35f15e09a04ae5a9c9c80dd
Summary: Remove a number of unused imports detected by the linter.
Reviewed By: wez
Differential Revision: D15776268
fbshipit-source-id: 221f45d275664d037bbabcac9858b40266b4833e
Summary:
With systemd integration enabled, if edenfs is running, or if edenfs' systemd service is active, `edenfsctl start` does nothing. This behavior differs from `edenfsctl start` with systemd integration disabled, and can cause `edenfsctl restart` to think that it successfully started edenfs.
Make `edenfsctl start` fail if edenfs is running and healthy, or if edenfs' systemd service is active (yet edenfs is unhealthy).
Reviewed By: chadaustin
Differential Revision: D15703310
fbshipit-source-id: ce0a13780ee03de1f896a938d002901023e5bdd3
Summary:
get_edenfs_start_cmd checks if edenfs is already running, and fails if it is. Most of the time, this check is redundant. This function is effectively called in five places:
* `edenfsctl start`
* `edenfsctl clone` if not running
* `edenfsctl restart` (`_graceful_restart`) with takeover=True
* `edenfsctl restart` (`_start`) if not running
* `edenfsctl restart` (`_finish_restart`) after stopping edenfs
The check is only necessary in one of these places (`edenfsctl start`). Move the check.
This refactor will allow us to run the check if systemd is enabled without duplicating code.
This diff should not change behavior (ignoring unimportant race conditions).
Reviewed By: simpkins
Differential Revision: D15703308
fbshipit-source-id: cbd4a70a3e0eb23da0d65d641d89a5ac022cd79f
Summary:
Update `eden start` to treat the `--gdb` argument like `--foreground`, and
always start in non-systemd mode, even if this would be the default otherwise.
The `--gdb` flag automatically implies `--foreground`
Reviewed By: wez
Differential Revision: D15492158
fbshipit-source-id: 89d65f7aef8c31131c7d95e054995df8a138cc41
Summary:
This diff just stubs out some functions that were either
not present or that were doing linux specific things that would
error out when attempted on macOS.
This diff doesn't implement macOS equivalents of the functions;
each of those can be tackled separately in follow up diffs.
Reviewed By: simpkins
Differential Revision: D15453050
fbshipit-source-id: 228044fc416d9170a4ba3aef6cd9b40194707f17
Summary:
Update `eden start` to honor the `--if-necessary` flag even when starting
with systemd.
Reviewed By: chadaustin, strager
Differential Revision: D14356541
fbshipit-source-id: b7c12b11a2fd63eeee84026bf4418702f794cbf0
Summary:
Update most of the `eden/cli/config.py` to use `Path` instead of `str` where
appropriate. This also updates several of the APIs in `util.py` that were
affected as well.
Reviewed By: chadaustin
Differential Revision: D14356543
fbshipit-source-id: a8f6d15b8870bf689eeb78f9fc0e9a0c65c97218
Summary:
Remove the `CheckoutConfig.hooks_path` attribute which is no longer used
anywhere.
Reviewed By: strager
Differential Revision: D14356542
fbshipit-source-id: 28b7e7aeb197aeb5d04edf8adfdcfe7946ffa0c7
Summary:
If no mounts are configured `eden fsck` previously threw an exception when
trying to compute the return value. It called `max(return_codes)` on an empty
return codes list, which would fail. This changes the code to handle that
code specially and report a warning that there was nothing to check.
Reviewed By: chadaustin
Differential Revision: D14352112
fbshipit-source-id: 3815ef34a12834d642f3eee867dda6dc1117c2ef
Summary:
Update the fsck `check_all()` function to use the newer
`EdenInstance.get_checkouts()` API instead of the older, internal
`_get_directory_map()` method.
Reviewed By: chadaustin
Differential Revision: D14352113
fbshipit-source-id: f1ceae72747833d89d5afd11da585ba96b5615a4
Summary:
This diff updates our internal eden packaging to correctly declare
a dep on python3, and to specify that python3 interpreter when building
the CLI.
It also allows importing of `readline` to fail, which is important because
the python3 on the system may not have a functioning readline extension.
Reviewed By: strager
Differential Revision: D14098276
fbshipit-source-id: ad1174e46b9b1c0ec1e602ecaeb59c1f0835472a
Summary: It's been a few weeks since we dropped support for `eden config --get` (D13737807), and we've received no reports of this being a problem. Delete the code which handles `eden config --get`.
Reviewed By: chadaustin
Differential Revision: D13772873
fbshipit-source-id: 04e2aa7f193806ee26c2f0ab1fe4246815c581a6
Summary:
This renames the CheckoutConfig `path` member variable to `backing_repo`.
The value in this variable is actually the path to the source control backing
repository, and not the path to the Eden checkout, which was confusing. (The
CLI tests were actually setting this up incorrectly in `create_test_mount()`,
but until now nothing in the tests had been using it, so we hadn't noticed
this problem earlier.)
I also changed `CheckoutConfig` to be a `typing.NamedTuple` as part of this
change.
Reviewed By: strager
Differential Revision: D13935006
fbshipit-source-id: 43b6ba4efa34f8c6fb8264de8bb31a33a6d73036
Summary:
`EdenInstance.get_config_value` raises a KeyError if the option or section is not set in any config files. Every caller of `EdenInstance.get_config_value` handles KeyError manually. Simplify code by letting callers specify a default value.
Aside from treating some options with an empty value as if they were unset, this diff should not change behavior.
Reviewed By: chadaustin
Differential Revision: D13737806
fbshipit-source-id: fdb7fa75d601de4644704813db38b671b27f73d7
Summary:
Update the `eden list` command to also report the current state for each
checkout if it is not running normally. Also added a `--json` flag to
print information as JSON so it can be consumed programmatically.
Reviewed By: strager
Differential Revision: D13503053
fbshipit-source-id: 4ef366f5bf4a1157036fdfd7ff1056079588e802
Summary:
I want to add an array config option to Eden. It's unclear how arrays should be printed by 'eden config --get'.
'eden config --get' is not used anywhere. Instead of figuring out the right way to print arrays, just kill support for the --get option.
If someone *is* using 'eden config --get', make it obvious and greppable that it's now deliberately broken.
Reviewed By: chadaustin
Differential Revision: D13737807
fbshipit-source-id: 7d7e2d0d5e90641c53b2caa463fc9e1854416745
Summary:
Add an option to forcibly kill `edenfs` with SIGKILL without ever attempting
to query it over thrift.
This should provide a way for users to reliably kill edenfs even if it is
hung. This shouldn't be necessary in most cases, but it lets us tell users to
run this command as a last resort if something is wrong.
Reviewed By: chadaustin, strager
Differential Revision: D13744188
fbshipit-source-id: 13378d04b3398e72ed3733d4ebb68b39868007bd
Summary:
The 'eden config' command prints output naively. This leads to confusing output when using the hg.extra_hgrc option. For example, in the following output, `mode = off` is part of hg.extra_hgrc's value, but it looks like it's a separate option in Eden's config:
```
$ eden config
[clone]
default-revision=master
[rage]
reporter=pastry --title "eden rage from $(hostname)"
[hg]
extra_hgrc=[fsmonitor]
mode = off
%include /etc/mercurial/repo-specific/eden.rc
[service]
experimental_systemd=True
```
Fix this issue by making 'eden config' output valid TOML:
```
[clone]
default-revision = "master"
[rage]
reporter = "pastry --title \"eden rage from $(hostname)\""
[hg]
extra_hgrc = "[fsmonitor]\nmode = off\n\n%include /etc/mercurial/repo-specific/eden.rc\n"
[service]
experimental_systemd = "True"
```
Reviewed By: simpkins
Differential Revision: D13661229
fbshipit-source-id: 76e4fa83ad186d04451623e3d8d87a78e4b821d8
Summary:
If --config-dir was not specified when running 'eden stop', and edenfs is unresponsive, StopCmd.run calls `check_health_using_lockfile(None)`. This violates check_health_using_lockfile's contract because its argument must be a non-null `str`. The result is that 'eden stop' fails:
```
$ eden stop
warning: edenfs is not responding: Socket read failed: timed out
Traceback (most recent call last):
File "[snip]/thrift/transport/TSocket.py", line 298, in read
buff = self.handle.recv(sz)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "[snip]/eden/cli/main.py", line 1221, in run
pid = client.getPid()
[snip]
File "[snip]/thrift/transport/TSocket.py", line 305, in read
message='Socket read failed: {}'.format(str(e))
thrift.transport.TTransport.TTransportException: Socket read failed: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
[snip]
File "[snip]/eden/cli/main.py", line 1231, in run
pid = check_health_using_lockfile(args.config_dir).pid
File "[snip]/eden/cli/util.py", line 104, in check_health_using_lockfile
lockfile = os.path.join(config_dir, LOCK_FILE)
File "[snip]/posixpath.py", line 78, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
```
Make 'eden stop' use the default config directory if --config-dir was not specified.
This issue was not caught by automated tests because they specify --config-dir explicitly.
This issue was not caught by type checkers because the type of argparse.Namespace's attrs unify with any type (including `str`).
Reviewed By: simpkins
Differential Revision: D13568405
fbshipit-source-id: 395aad7e3a80b91fec05969b648a51939281ffec
Summary: 'eden clone' starts the EdenFS daemon if it's not already running. If the user opted into systemd integration, make sure the daemon is started via systemd.
Reviewed By: wez
Differential Revision: D13498650
fbshipit-source-id: 8c5da579f9b79363e2d825ea7c85d423cbcc6509
Summary:
Rename `ClientConfig` to `CheckoutConfig` to move slightly closer towards
standardizing on the term "checkout" rather than "client" to refer to an Eden
mount point directory.
Reviewed By: chadaustin
Differential Revision: D13437952
fbshipit-source-id: 5086b4187eb975c860d48cadf0ccd4e5dce78e9a
Summary:
I want to allow opting into systemd using a setting in ~/.edenrc. Since should_use_experimental_systemd_mode is a global function, it can't read any configs. Make the config file visible to should_use_experimental_systemd_mode by moving it into EdenInstance.
This diff should not change behavior.
Reviewed By: simpkins
Differential Revision: D13370823
fbshipit-source-id: b604db66954d0a08973030daae38bf6b1433e821
Summary:
If the user opted into systemd integration, make 'eden restart' restart the systemd service.
Don't support --graceful yet. --graceful will be implemented in a later diff. Mark it as explicitly unsupported for now.
Reviewed By: chadaustin
Differential Revision: D13271438
fbshipit-source-id: e505f00cbc337a2bf4da77bdea4b8faba063607c
Summary: Several tests for 'eden start', 'eden stop', and 'eden status' need to pass command-line arguments to fake_edenfs. With systemd support enabled, make 'eden start' forward daemon arguments to fake_edenfs, making these tests pass.
Reviewed By: wez
Differential Revision: D13249891
fbshipit-source-id: 9008a361fce7a5629535cc9d245b86073ee70826
Summary:
Add the plumbing necessary to make 'eden start' start a systemd user service. This is only enabled if you opt in using EDEN_EXPERIMENTAL_SYSTEMD.
Currently, only fake_edenfs works. The real edenfs doesn't work yet because it needs root access to configure mount points.
'eden restart', 'eden stop', etc. are not affected by this diff (and are probably broken with EDEN_EXPERIMENTAL_SYSTEMD enabled).
Reviewed By: simpkins
Differential Revision: D10849390
fbshipit-source-id: c087a6498951ff100e5c80bd07ad869b2709e1b3
Summary:
Add basic high level logic to fsck to begin fixing problems that are found.
This adds basic checks to decide if we should fix errors or not.
If errors are found and need to be fixed, this creates a new directory inside
the checkout state directory in `.eden` to record the actions taken by this
fsck run. This directory will contain a log file that records the actions
taken. In the future the fsck logic will also use this directory to store
copies of the corrupted inode data, and can store extracted orphan inode data
here as well.
Reviewed By: wez
Differential Revision: D12955044
fbshipit-source-id: 06c1e17a0a51fa5e2c0f2aab83b367b9358fd004
Summary: Update the CLI code to make the pyre type checker happy.
Reviewed By: wez
Differential Revision: D13035413
fbshipit-source-id: d201f2e65667e0ce1bf4a73fbb05878e8711ad16
Summary:
Move the error printing logic up into the CLI-specific `FsckCmd` class and out
of the lower-level `fsck.FilesystemChecker` class.
Reviewed By: wez
Differential Revision: D12955043
fbshipit-source-id: 4b5a1fcb791e784c736672484990b5406ee29b65
Summary:
Improve the way `eden fsck` processes its arguments. Previously it required a
single checkout path as an argument. If an `--overlay` argument was specified
it used this instead of the checkout path to find the directory to check, but
the checkout path argument was still required (but was ignored).
This changes the code to accept one or more paths as arguments. These paths
can either be the path to an Eden checkout (which does not have be currently
mounted), or the path to a checkout state directory inside the `.eden` state
directory. The `fsck` code automatically figures out what type of directory
the argument refers to and processes it correctly.
If no paths are specified `eden fsck` now automatically checks all configured
checkouts that are not currently mounted.
Reviewed By: wez
Differential Revision: D12955041
fbshipit-source-id: c37bc6752746d8ecd0f4a672d0d3b25d1c3a4fa1