Commit Graph

147 Commits

Author SHA1 Message Date
Jia Chen
c717ef0d7d Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Differential Revision: D19548623

fbshipit-source-id: 12d5e8ec6450de42107d07b230e4b2d0824f7c9d
2020-01-24 12:32:43 -08:00
Wez Furlong
f6a9a6f7e8 eden: du: revise instructions for cleaning up LFS
Summary: `hg gc` can now clean things up there, so suggest that.

Reviewed By: quark-zju, fugalh

Differential Revision: D19413816

fbshipit-source-id: 1c6c08ed9fb4757390883d908531d9b3a7da302d
2020-01-15 12:31:56 -08:00
Wez Furlong
bb01c59162 eden: call eden redirect unmount at unmount time
Summary:
The intent is to allow macOS to make a best effort attempt
to detach any disk images associated with redirections.

D18795800 taught redirect to detach rather than a simple unmount,
and we need to give it an opportunity to detach when we unmount
gracefully so that all resources are released on shutdown.

The implementation of this diff ties into the same mechanism that
we use to shutdown the buck daemon when we unmount or restart which
has the nice side effect of showing the output from the underlying
`eden redirect unmount` command.

In an earlier iteration of this diff I tried making the server code
run `eden redirect unmount` but it happened too late in the process
to be effective: the thrift server had already been torn down in the
shutdown case and we need privs to perform the unmount.

Reviewed By: pkaush

Differential Revision: D18804080

fbshipit-source-id: 0b409130752121c56a46c9b2e46b50e5abee8200
2019-12-04 08:45:26 -08:00
generatedunixname89002005307016
4c76d686a8 Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: grievejia

Differential Revision: D17956249

fbshipit-source-id: d5c8b5aa73151b3fea67aec35d70f332030da2c9
2019-10-16 16:56:29 -07:00
Andres Suarez
fbdb46f5cb Tidy up license headers
Reviewed By: chadaustin

Differential Revision: D17872966

fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
2019-10-11 05:28:23 -07:00
Adam Simpkins
0351c6c772 update the CLI to exit with the correct status for CMake-based builds
Summary:
The Python 3 zipapp module always exits with return code 0 if the main
function returns.  Therefore we need to add our own wrapper function that
handles calling `sys.exit()` if we want to exit with a non-zero status.

Reviewed By: wez

Differential Revision: D17678021

fbshipit-source-id: 5944c75d8e765ab3e3fa038fa6f2eee95ab0e780
2019-10-01 08:21:56 -07:00
Wez Furlong
bc76cfc8b3 eden: gc now compacts sparseimage files for macos redirections
Summary:
The sparse images that we mount in place of bind mounts on macos
can grow over time, and don't automatically shrink if their contents are
purged.

This commit teaches `eden gc` to run `hdiutil compact` on these images
to reclaim space.

The output from `hdiutil compact` is really verbose and noisy, so we
suppress it unless there is an error.

Reviewed By: simpkins

Differential Revision: D17254235

fbshipit-source-id: 944b3824717c8b46d8170ec729c04a93323ab7f0
2019-09-27 07:14:58 -07:00
Wez Furlong
28de3ee251 eden: fix eden chown to chown the mount point of a redirection
Summary:
We're seeing an issue where for an Eden instance started
as root a subsequent chown doesn't chown the root of the bind mount
and thus makes it impossible to write into the directory.

Reviewed By: simpkins

Differential Revision: D17620135

fbshipit-source-id: 4ee511234c551bbfc7330a60ee85fc5efd329d73
2019-09-26 18:43:29 -07:00
Chad Austin
ba2b017fad remove infer_client_from_cwd in lieu of require_checkout
Summary:
`require_checkout` returns an EdenCheckout, so infer_client_from_cwd
is no longer required.

Reviewed By: wez

Differential Revision: D17485008

fbshipit-source-id: b6ff6d4b28a48b56bd56fe7116313d6a64642f1e
2019-09-19 18:17:12 -07:00
Chad Austin
4bf7130c07 fix error output when eden info is given a non-eden path
Summary:
When passing a non-Eden path to `eden info`, it would spit out a
Python stack trace. Fix that by using the standard checkout lookup
code.

Reviewed By: wez

Differential Revision: D17484897

fbshipit-source-id: beae64c4aa81af201e7560b44f0d103196e4ab35
2019-09-19 18:17:12 -07:00
Adam Simpkins
814792d584 add an --if-not-running flag to eden start
Summary:
Add a flag to cause `eden start` to exit successfully without doing anything
if EdenFS is already running.  This flag makes it slightly easier for
automation to ensure that EdenFS is running, without logging warnings if
EdenFS was already running.

I also cleaned up the error message slightly when `eden start` is used
without this flag and fails if EdenFS was already running.  Previously the
exception thrown was unhandled so it also printed a python backtrace.  Now the
code throws an exception that is caught by the higher level command line code,
so it is printed in a more user-friendly way.

Reviewed By: wez

Differential Revision: D17440486

fbshipit-source-id: d7661ef7be7159bf5542b20e99a0b5495690e5a2
2019-09-19 15:21:28 -07:00
Wez Furlong
eeb57507e4 eden: du: ignore FileNotFoundError when stat'ing ignored files
Summary:
It's possible that status includes ignored files from
the overlay that are no longer accessible because a bind mount
is overlaid on top of the overlay!

Ideally we'd account for the space occupied by those files,
but for now we'd rather not error out when attempting to stat
them, so silently ignore that class of error.

Reviewed By: chadaustin

Differential Revision: D17415965

fbshipit-source-id: 96d467ee4e85ad5bdc730e4cfffe4c15a83a12ed
2019-09-17 15:03:23 -07:00
Wez Furlong
51eaad1918 eden: chown now accepts user and group names (not just ids)
Summary: This makes it a bit more human friendly

Reviewed By: chadaustin

Differential Revision: D17249465

fbshipit-source-id: 40d5afc77ded34237e1860d5b91e9257a732e480
2019-09-17 07:29:40 -07:00
Wez Furlong
b2d7ab7fec eden: teach chown to use redirection data
Summary:
D17236366 will disable the getBindsMount thrift call and
remove the internal source of data about bind mounts.  We instead
have a more current set of data from the `redirect` command, so
tech `eden chown` to use that data.

Reviewed By: chadaustin

Differential Revision: D17249433

fbshipit-source-id: 853f24e729814c501768e9834765e1be283d6aac
2019-09-17 07:29:39 -07:00
Wez Furlong
5a304aa346 eden: add eden du command for inspecting disk usage
Summary:
Understanding disk usage and cleaning it up is a relatively frequently
asked question, and users are often shocked that "eden is using so much space"
when the reality is that they're just seeing the aggregate from a `du` command
that includes their build artifacts from their bind mounts.

This diff adds `eden du` as a friendly utility that helps to break down the
disk usage into meaningful categories and gives some hints on how to reclaim
space.

Reviewed By: chadaustin

Differential Revision: D17252322

fbshipit-source-id: 7348692c95cd319ca315c5be466b397b4969971d
2019-09-09 20:43:26 -07:00
generatedunixname89002005289445
9b9015c137 Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: grievejia

Differential Revision: D17255059

fbshipit-source-id: 4eb207bcefb699c1886d1f0c1511b6d26100ff0e
2019-09-09 07:41:21 -07:00
generatedunixname89002005289445
13e683608d Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: sinancepel

Differential Revision: D17135557

fbshipit-source-id: 07afef940271a277c75834892733901d070bfa5f
2019-08-30 13:37:34 -07:00
Adam Simpkins
b918dab7cd fix "eden prefetch" to find the edenfs daemon correctly
Summary:
Update the `eden prefetch` code to use the `require_checkout()` function,
which correctly finds the correct EdenFS instance that is serving this
checkout.  Previously the prefetch logic found the default EdenFS instance,
which may be different from the one that was serving the specified checkout.

Reviewed By: wez

Differential Revision: D16878489

fbshipit-source-id: fed366df61960b5b87399bcd1d2f3f79aefc8dba
2019-08-20 15:35:31 -07:00
generatedunixname89002005289445
01d06886cb Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: sinancepel

Differential Revision: D16863919

fbshipit-source-id: c76f41992b9a1a57080eed932724b65c1fd846f5
2019-08-16 14:44:25 -07:00
Wez Furlong
6e127b8bd8 eden: fixup spurious errors when using prefetch --pattern-file
Summary:
our argparse stuff was configured to require 1+ patterns
which meant that an invocation like:

```
echo 'fbcode/eden/fs/TARGETS' | eden prefetch --pattern-file /dev/stdin
```

would emit:

```
eden prefetch: error: the following arguments are required: PATTERN
```

the workaround was to specify a dummy pattern argument.

This diff fixes up the argparse config to make the pattern argument be 0+ patterns.

Reviewed By: pkaush

Differential Revision: D16831732

fbshipit-source-id: 93cb4c4677b1af8b9d4824bcad60708c40867375
2019-08-15 14:02:17 -07:00
Wez Furlong
87dad4e133 eden: remove b'filename' from eden prefetch output
Summary:
This was an unanticipated casualty of some unicode vs bytes
work in the past, and we hadn't gotten around to fixing this... until now!

Reviewed By: pkaush

Differential Revision: D16831603

fbshipit-source-id: dd38751e6d0b1c242937a7dbb150f3aa15d1c8ae
2019-08-15 14:02:17 -07:00
Puneet Kaushik
07958c15ff Implement eden prefetch for Windows
Summary: On POSIX system we use InodeTree structure to implement prefetch. These structures are missing on the Eden Windows. We will instead use mercurial's prefetch to prefetch the contents for us.

Reviewed By: strager

Differential Revision: D16742336

fbshipit-source-id: db0a389503cb98469707c07b6da412056f4dd72e
2019-08-14 19:11:33 -07:00
Puneet Kaushik
19aca3a6b2 edenfsctl starts edenfs in background on Windows
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
2019-08-14 12:11:05 -07:00
Puneet Kaushik
0f54d0eb14 Fixing OSS Eden cli to use the updated fb303_core
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
2019-07-26 11:46:11 -07:00
Adam Simpkins
9e832076a7 enable debug subcommands on Windows
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
2019-07-22 19:05:26 -07:00
Brian Strauch
4319ad2cd0 Aesthetic fixes
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
2019-07-22 13:37:38 -07:00
Chad Austin
59784a6d52 fix status checks when running with new CLI and older edenfs process
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
2019-07-18 20:48:44 -07:00
Chad Austin
ae35e76c9c add a getDaemonInfo() thrift method
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
2019-07-17 13:47:02 -07:00
Brian Strauch
a6f952a900 eden top persistence
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
2019-07-17 11:36:40 -07:00
Brian Strauch
e16179b89b Top class
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
2019-07-15 14:30:25 -07:00
generatedunixname89002005289445
1be6e4d957 Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: grievejia

Differential Revision: D16183608

fbshipit-source-id: 529a893a021c8101e6ad28b8d88d22d4d05aa732
2019-07-10 14:48:04 -07:00
Puneet Kaushik
22568aa4d0 Removing import debug and rage from Windows main.py
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
2019-07-03 19:05:24 -07:00
Wez Furlong
66eb606372 eden: add eden redirect subcommand
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
2019-06-25 18:42:38 -07:00
Puneet Kaushik
16c3db0b7f Hide the type annotation in _report_error to make status work on Windows
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
2019-06-20 06:30:39 -07:00
Puneet Kaushik
c304b27c31 Excluding the unused/not working imports from windows main.py
Reviewed By: strager

Differential Revision: D15902479

fbshipit-source-id: b7c14d90cd910186566635c9a1adbd4c8bd81375
2019-06-20 06:30:39 -07:00
Puneet Kaushik
b52627c0c8 Define the exit codes for Windows Edencli.
Reviewed By: chadaustin

Differential Revision: D15902168

fbshipit-source-id: 77c5101e746f491404b9216dc87bb2295e3d8bf2
2019-06-19 17:54:55 -07:00
Adam Simpkins
9bfb48c921 update license headers in .py files
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
2019-06-19 17:02:46 -07:00
Adam Simpkins
20f211acb8 remove unused python imports
Summary: Remove a number of unused imports detected by the linter.

Reviewed By: wez

Differential Revision: D15776268

fbshipit-source-id: 221f45d275664d037bbabcac9858b40266b4833e
2019-06-12 14:00:57 -07:00
Matt Glazar
fa4e4cf78e Make 'edenfsctl start' fail if already running (systemd)
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
2019-06-11 11:02:13 -07:00
Matt Glazar
6ceb5973e2 Refactor 'edenfs is already running' check
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
2019-06-10 20:45:30 -07:00
Adam Simpkins
df044b9286 make eden start --gdb work even when systemd is the default
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
2019-05-28 12:55:41 -07:00
Wez Furlong
a96e312aa1 eden: eden doctor no longer fatals on macOS
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
2019-05-22 14:46:37 -07:00
Sinan Cepel
4547deafca Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: dkgi

Differential Revision: D15283973

fbshipit-source-id: b1451da50dbbee0f71260d50caece21799f008f2
2019-05-09 18:17:36 -07:00
generatedunixname89002005289445
1f369ed67b Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: shannonzhu

Differential Revision: D14525100

fbshipit-source-id: ca27023b89da9eb8f983caaceb78e9fb4fea7bfe
2019-03-19 13:15:29 -07:00
generatedunixname89002005289445
519fbabc9b Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: shannonzhu

Differential Revision: D14426843

fbshipit-source-id: bda3fa62d5af6d4c6c5120e793e0da79c4a145f0
2019-03-12 13:56:33 -07:00
Adam Simpkins
574c34ffbd fix "eden start --if-necessary" when using systemd
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
2019-03-08 19:06:04 -08:00
Adam Simpkins
1b7f39fc56 convert most the CLI config code from str to Path
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
2019-03-08 19:06:04 -08:00
Adam Simpkins
98ef256f4c remove CheckoutConfig.hooks_path
Summary:
Remove the `CheckoutConfig.hooks_path` attribute which is no longer used
anywhere.

Reviewed By: strager

Differential Revision: D14356542

fbshipit-source-id: 28b7e7aeb197aeb5d04edf8adfdcfe7946ffa0c7
2019-03-08 11:10:01 -08:00
Adam Simpkins
4b9b3bf7fd fix exception in eden fsck when no mounts are configured
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
2019-03-08 11:10:00 -08:00
Adam Simpkins
e28cceca9f minor clean up to some of the fsck code
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
2019-03-08 11:10:00 -08:00