Commit Graph

72 Commits

Author SHA1 Message Date
Zejun Wu
8c645b0e20 Include label stack in HaxlException when ReportExceptionStack is on
Summary:
Add a new `ReportFlag` `ReportExceptionStack`. When it is enabled, we will
include the label stack in `HaxlException`. This will allow us provide stack
in `HaxlException` in non-prof rts. The label stack can also provide details
at different level compared to the `CostCentreStack`:

* with `-fprof-auto` or `-fprof-auto-top`, we can get reasonably detailed ccs.
* label stack only works well when enough labels are added either manually or
  by preprocessing.
* label stack works better for cases where the different `Haxl` computations
  are constructed dynamically in some common framework, where we also create
  dynamic labels.

Reviewed By: simonmar

Differential Revision: D32936619

fbshipit-source-id: 4aacd576dff062706a848a93f60d93982e4b8717
2021-12-09 20:40:29 -08:00
Aditya Buridi
769213ea57 Adds schedulerHint tests for DataSource (#136)
Summary:
Pull Request resolved: https://github.com/facebook/Haxl/pull/136

Adds unit test for schedulerHint in DataSource. Currently tests the TryToBatch and SubmitImmediately modes. Tests fail if
. Batch size is not equal to the no of requests in `TryToBatch` mode
. More than one request is submitted in `SubmitImmediately` mode.

Reviewed By: DylanZA

Differential Revision: D24922114

fbshipit-source-id: f786b93e9e0b7c7c731ede5fc54780d9e1b87432
2020-11-16 08:14:20 -08:00
Zejun Wu
24ef4e6b87 Test against ghc 8.8 and 8.10 and regenerate .travis.yml
Summary: Test against ghc 8.8 and 8.10 and regenerate .travis.yml

Reviewed By: babyLiyuan

Differential Revision: D23090356

fbshipit-source-id: 1d5662215f523025b9d59f297c400615c13f4ef5
2020-08-13 09:16:38 -07:00
Zejun Wu
04da91d564 Relax dependency constrainst for ghc-8.10
Summary:
New versions are available for aeson, hashable and time. We need bump the
upper bound so that we can build haxl on ghc-8.10.

Reviewed By: rayshih

Differential Revision: D23090291

fbshipit-source-id: 58b874da0eb658e50a23fb0acb2cbcee42fdf1c7
2020-08-13 09:16:38 -07:00
Anubhav Bindlish
2a20601b3b Add test for Async exceptions
Summary:
This unit test demonstrates 2 things:

1) It is possible for Haxl computation to be interrupted in ways that block the scheduler indefinitely
2) Calling `sanitizeEnv` on the env from such a computation allows us to reuse it for future computations. If we don't do that, future computations can still block even without any exception thrown during the 2nd run.

Reviewed By: DylanZA

Differential Revision: D22397981

fbshipit-source-id: 48dfca49ab3485693bc772ff346945779809d9e8
2020-07-15 04:39:37 -07:00
Dylan Yudaken
e978f29f64 clean up monadbench a bit (#118)
Summary:
Pull Request resolved: https://github.com/facebook/Haxl/pull/118

* add ability to set reporting flag for benchmarking
* add argument parser
* add a test for using lots of labels

Reviewed By: simonmar

Differential Revision: D20792436

fbshipit-source-id: c87bd8e996397cb2ef229cf59927530a4dac20df
2020-04-24 08:02:52 -07:00
Dylan Yudaken
14ebbe2c85 Add tracking of Fetch Stats for the same batch (#111)
Summary:
Pull Request resolved: https://github.com/facebook/Haxl/pull/111

Right now BackgroundFetches produce multiple FetchStats for the same batch, but it is not possible to link these together to get an idea of how big the batch was.
This introduces a field to FetchStats that can be used to link batches together as well as a utility method to do this in a default manner

Reviewed By: watashi

Differential Revision: D19469048

fbshipit-source-id: fce687c49ac4cbdc7cbd6804f37b6f120d7efad3
2020-01-22 04:25:34 -08:00
Dylan Yudaken
c49ba39bd9 Remove FutureFetch from Haxl (#109)
Summary:
Pull Request resolved: https://github.com/facebook/Haxl/pull/109

FutureFetch is unused (except for one test) and overall has not proven itself to be a useful fetch type. It adds a new waiting point (the others being BackgroundFetch and Async/Sync fetches) which can add latency. For example if all three are dispatched in one round how would the scheduler know ahead of time which one to wait on in order to make forward progress.

Reviewed By: simonmar

Differential Revision: D19410093

fbshipit-source-id: 40c900fbff9e06098acb2a21fc59b49adefadc5b
2020-01-16 08:40:22 -08:00
Karen Ang
7a2aa30f90 Switch to use BasicHashTable for Haxl DataCache
Summary: Switch to use `BasicHashTable` from `hashtables` package instead of `Data.HashMap.Strict` for `DataCache`

Reviewed By: simonmar

Differential Revision: D19219048

fbshipit-source-id: a2a8df0e715c202ca79a1f3a1c0dad133788e1eb
2020-01-10 14:37:38 -08:00
Dylan Yudaken
e5f95d6213 move minimum supported version to GHC 8.2
Summary: Bump the minimum Haxl version to GHC 8.2, which at this point is 2.5 years old but more importantly has many features that are really helpful in Haxl (such as the hs_try_put_mvar API function, which is really useful for BackgroundFetch)

Reviewed By: josefs

Differential Revision: D19327952

fbshipit-source-id: f635068fe9fb8f1d1f0d83ccbf9c3c04947183a0
2020-01-10 01:32:54 -08:00
Josef Svenningsson
21d4a7cca5 Add ParallelTests to .cabal file (#104)
Summary:
Pull Request resolved: https://github.com/facebook/Haxl/pull/104

See title

Reviewed By: lolotp

Differential Revision: D18749316

fbshipit-source-id: 99e6c29a10146401e9a2460622915e9f94268d8c
2019-11-29 07:07:47 -08:00
Karen Ang
67638ce8bd Move CallGraphRef to Haxl Env
Summary:
Adds the ability for one to record the function callstack within the `Haxl` monad.
The main function is `withCallGraph`, and supporting types are in `Haxl.Core.CallGraph`.

Reviewed By: watashi

Differential Revision: D14857851

fbshipit-source-id: daab97e8144ff63104ad9e79a3a792a4471e5588
2019-05-14 14:22:50 -07:00
Anubhav Bindlish
5f2ebd2580 Add correctness tests for outgone-fetches logging (#99)
Summary:
Pull Request resolved: https://github.com/facebook/Haxl/pull/99

This adds unit tests to haxl, to make sure we are tracking the outgone
fetches correctly..

Reviewed By: simonmar

Differential Revision: D14683672

fbshipit-source-id: 49a318f0b8aa38c2af154fcbe0946122e70b9565
2019-05-09 06:46:56 -07:00
Anubhav Bindlish
f99afd1354 Add WriteTests to haxl.cabal
Summary: Whoops forgot to do when I added the test file.

Reviewed By: zilberstein

Differential Revision: D14874686

fbshipit-source-id: 5bb4b83368f03e9867516b3876acb83ea8aa6852
2019-04-10 10:52:58 -07:00
Simon Marlow
24494b5e31 Fix lower bound on base; we don't support GHC 7.6.3 (#96)
Reviewed By: watashi

Differential Revision: D10011102

fbshipit-source-id: f607e2a6bc9ec11bbb107b94f6d94d70411df1f4
2018-09-24 15:56:57 -07:00
Simon Marlow
e187bc2474 Updates for GHC 8.4.x and 8.6.x (#97)
Summary: And bump version to 2.0.1.1

Reviewed By: anubhav94N

Differential Revision: D10011092

fbshipit-source-id: 4d45f79fb4c89112d29d40f0d53a50441a443729
2018-09-24 14:20:57 -07:00
Simon Marlow
9e6d3c3523 Bump to 2.0.1.0
Summary: The MemoVar export causes a minor version bump

Reviewed By: anubhav94N

Differential Revision: D8588703

fbshipit-source-id: 8dfb5ed5f44a681810860080b8413fc61bf58c89
2018-06-25 04:05:40 -07:00
Oleg Grenrus
a8e6d16310 Allow aeson-1.4
Summary: Closes https://github.com/facebook/Haxl/pull/93

Reviewed By: watashi

Differential Revision: D8379516

Pulled By: malmerey

fbshipit-source-id: 5f77333490636714c8b951a5bba6f26329a8e4fd
2018-06-12 11:53:25 -07:00
Oleg Grenrus
6582f45c21 Remove aeson bound from test-suite
Summary:
It's inherited from the library anyway.
Closes https://github.com/facebook/Haxl/pull/91

Reviewed By: simonmar

Differential Revision: D8074585

Pulled By: malmerey

fbshipit-source-id: 35955c2426df0725835a4351ee140012ac102c82
2018-05-21 04:49:10 -07:00
Simon Marlow
79e81825ef 2.0.0.1
Summary:
minor version bump required so that I can update the Hackage package
to fix the URLs.

Reviewed By: codemiller

Differential Revision: D8057062

fbshipit-source-id: 2204d28a965df3933b7acf5b81c62b4380835e63
2018-05-18 11:55:27 -07:00
Oleg Grenrus
adb6d5c28f Support GHC-8.4.1 (SMP), lax bounds
Summary: Closes https://github.com/facebook/Haxl/pull/88

Reviewed By: simonmar

Differential Revision: D7365219

Pulled By: niteria

fbshipit-source-id: 28ff85b065000e367ef919b970bc59a76faa15fb
2018-03-22 13:08:28 -07:00
Simon Marlow
6b75496a29 Correctly account for allocation done in child threads
Summary:
This isn't pretty, but it's the least intrusive and most efficient way
I could find to do it.

The tricky part is that when doing multiple putResults in the same
child thread, we have to ensure the *last* one (and only the last one)
is putResultFromChildThread.

Reviewed By: xich

Differential Revision: D6519631

fbshipit-source-id: 1c3c40f311031ac4cc8ed82daefcb7740b91541e
2018-01-10 08:51:53 -08:00
Simon Marlow
c1c789a71f Change license to plain BSD3
Reviewed By: mic47, niteria

Differential Revision: D6519157

fbshipit-source-id: 7fd977837bb7dd8463d697d685107aaf07c95255
2017-12-08 04:33:35 -08:00
Simon Marlow
e75c7f3a26 Add a generic concurrent IO datasource
Summary:
Mainly aimed at
* lowering the barrier to entry by enabling some simple use cases
* providing more example code
* providing a basis for some examples in a future blog post

Reviewed By: zilberstein

Differential Revision: D6172870

fbshipit-source-id: 9493cec7ccd78c32b54cb24923f9c574e877c529
2017-10-31 04:23:46 -07:00
Simon Marlow
720caa39bc version -> 2.0.0.0
Summary: Getting ready for a Haxl 2.0 release on Hackage

Reviewed By: niteria

Differential Revision: D6172830

fbshipit-source-id: eb53c3e5b126499fb66d528516d2b65eb20e3e7a
2017-10-31 04:23:46 -07:00
Simon Marlow
bc1f39f477 Build the benchmarks only if requested
Reviewed By: niteria

Differential Revision: D6172800

fbshipit-source-id: 6ded874ff575d35a564808be2bdf29347b39a3ca
2017-10-31 04:23:46 -07:00
Simon Marlow
3dbb11f6fe Cleanup and fix builds with other GHC versions
Summary:
Now that the Haxl 2 diff has landed, I wanted to take the opportunity to reorganise the codebase.

I split parts of `Haxl.Core.Types` out into

* `Haxl.Core.Flags`, the `Flags` type and functions
* `Haxl.Core.DataSource`: the `DataSource` class and related stuff

and I split the massive `Haxl.Core.Monad` module into smaller modules:

* the base `Haxl.Core.Monad` with the types and instances
* `Haxl.Core.Fetch`: data-fetching functionality
* `Haxl.Core.Run`: the scheduler, and `runHaxl`
* `Haxl.Core.Profile`: profiling
* `Haxl.Core.Parallel`: `pAnd` and `pOr`
* I've also moved all the memoization support into `Haxl.Core.Memo`.

This commit also fixes the build on GHC 7.8.x, 7.10.x, and 8.2.x, all the Travis builds are green again.

Closes https://github.com/facebook/Haxl/pull/79

Reviewed By: zilberstein

Differential Revision: D6030246

Pulled By: simonmar

fbshipit-source-id: 5a0dc708cf72f8ed0906f1e99000976dbfbc89e2
2017-10-27 03:37:32 -07:00
Simon Marlow
b67f7f6370 Haxl 2
Summary:
This is a complete reworking of the way that Haxl schedules I/O.  The
main benefits are:

* Data fetches are no longer organised into rounds, but can be
  arbitrarily overlapped with each other and with computation.  The
  scheduler supports an arbitrary queue of work items which it can
  evaluate while data-fetching is taking place in the background.  To
  take advantage of this, data sources must implement a new form of
  `PerformFetch`, namely `BackgroundFetch`.  The old forms of
  `PerformFetch` are still supported, but won't benefit from any
  additional concurrency.

* It is now possible to specify on a per-data-source basis whether
  fetching should be optimised for batching or for latency.  A request
  to a data source that doesn't benefit from batching can be submitted
  immediately.  This is done with the new `schedulerHint` method of
  `DataSource`.

Reviewed By: niteria

Differential Revision: D4938005

fbshipit-source-id: 96f12ad05ee62d62474ee4cc1215f19d0a6fcdf3
2017-10-03 00:28:54 -07:00
Bartosz Nitka
f1df1cb368 Prepare for 0.5.1.0 release
Summary:
We need a release for GHC 8.2.1 compatibility:
https://github.com/facebook/Haxl/issues/70

(Note: this ignores all push blocking failures!)

Reviewed By: simonmar

Differential Revision: D5488485

fbshipit-source-id: 61ae115e7456beb1dd8855d387690e13a1e09bdc
2017-07-25 04:24:40 -07:00
Bartosz Nitka
142f53c473 Test with GHC 8.2.1
Summary: GHC 8.2.1 has been released.

Reviewed By: watashi

Differential Revision: D5478389

fbshipit-source-id: 1be337521e409bbb4c01ef9b22d164973519a3aa
2017-07-23 22:08:55 -07:00
Simon Marlow
1e0d31e278 Fix text dependency
Summary: text prior to 1.2.1.0 doesn't work because we need the Binary instance

Reviewed By: niteria

Differential Revision: D5027630

fbshipit-source-id: d6eeefb40a19ae2c0aaccaad868dc42ed4976ea5
2017-05-09 04:18:48 -07:00
Simon Marlow
a9dd8ee43e Fix license spec in the .cabal file (#67)
Reviewed By: codemiller

Differential Revision: D4938031

fbshipit-source-id: 1ac10bec8a6d53ab3863a9045c0d3a9ee696369a
2017-04-24 05:38:39 -07:00
Simon Marlow
493c42fa0f Handle exceptions correctly in async datasources
Reviewed By: zilberstein, niteria

Differential Revision: D4868473

fbshipit-source-id: 0daf35e23f7ca4e87c3316786f3ac7a8ee7148cf
2017-04-19 12:27:42 -07:00
Oleg Grenrus
6a218f9110 Allow aeson-1.2
Summary: Closes https://github.com/facebook/Haxl/pull/69

Differential Revision: D4897787

Pulled By: watashi

fbshipit-source-id: aa8cbcb52822b0a1a3d31112313f495fc11efe1c
2017-04-16 18:53:48 -07:00
Oleg Grenrus
f3d340924c Bump more bounds
Summary:
- `binary-0.9` is accidental major jump and is now deprecated, I'm not sure what's best to do, cabal solver should pick `-0.8.x.y.` version
- `HUnit` and `time` changes do not affect use in haxl.
Closes https://github.com/facebook/Haxl/pull/68

Differential Revision: D4843906

Pulled By: JonCoens

fbshipit-source-id: b97c78e644a170745d7a29aab5c137e86f7018be
2017-04-06 10:18:42 -07:00
Oleg Grenrus
990b80cbc6 Test with GHC 8.0.2
Summary:
If this goes ok, can we have a release?
Closes https://github.com/facebook/Haxl/pull/66

Reviewed By: simonmar

Differential Revision: D4409114

Pulled By: niteria

fbshipit-source-id: 6d6e88f1cf7b9ae2d851eaa86966f2eb417b4d7e
2017-01-12 10:01:33 -08:00
Oleg Grenrus
d8f2eeed13 Allow vector-0.12, time-1.7; Drop unused directory
Summary: Closes https://github.com/facebook/Haxl/pull/65

Reviewed By: xich

Differential Revision: D4391469

Pulled By: niteria

fbshipit-source-id: d9a54fe6c4a255c0e82b26aca2849265fd7e8b53
2017-01-08 12:31:32 -08:00
Oleg Grenrus
d77b818a82 Allow aeson-1.1
Summary:
Alternatively we could change dependency to `aeson-compat`, which has less major version bumps (because it has smaller public API surface, yet one have to be careful .e.g. not to rely on instance implementations).
Closes https://github.com/facebook/Haxl/pull/64

Differential Revision: D4385525

Pulled By: xich

fbshipit-source-id: 72246e0f9144728e618de7bfcf983531bd3d281a
2017-01-05 17:01:26 -08:00
Oleg Grenrus
b0a5f7b8a8 Rename Show1 to ShowP
Summary:
Resolve #62
Closes https://github.com/facebook/Haxl/pull/63

Reviewed By: JonCoens

Differential Revision: D4299180

Pulled By: niteria

fbshipit-source-id: 0bcbefd26184d1e7ad5de99a806ce0cf4b57d1a6
2016-12-09 14:31:39 -08:00
Bartosz Nitka
b8cb1d850f Bump version before release
Summary: Closes https://github.com/facebook/Haxl/pull/61

Reviewed By: darshankapashi

Differential Revision: D4222554

Pulled By: niteria

fbshipit-source-id: d634be076eef94c00277952e6c8bc1920b052f89
2016-11-22 14:16:26 -08:00
Bartosz Nitka
c3d650e173 Allow HUnit 1.5
Summary:
According to #1965:

> Stackage nightly builds will soon move to HUnit-1.5.
Closes https://github.com/facebook/Haxl/pull/60

Reviewed By: xich

Differential Revision: D4221036

Pulled By: niteria

fbshipit-source-id: d3b011c7510ab9eceed9a1afdce0e55ed0983cf0
2016-11-22 13:01:33 -08:00
Oleg Grenrus
bc791fd734 Allow HUnit-1.4
Summary: Closes https://github.com/facebook/Haxl/pull/59

Reviewed By: niteria

Differential Revision: D3987227

Pulled By: algoriddle

fbshipit-source-id: 3be85a3eef2f40fd0a0efe0aee09714646632b4f
2016-10-07 05:46:38 -07:00
Oleg Grenrus
f80fe801a2 Make haxl compile cleanly with stack build --pedantic
Summary: Closes https://github.com/facebook/Haxl/pull/56

Reviewed By: JonCoens

Differential Revision: D3973977

Pulled By: simonmar

fbshipit-source-id: 527e17407dbeb3376955733949b0edb8b581122a
2016-10-05 05:46:30 -07:00
Gergely Szilvasy
98b403f0a4 fix package
Summary: Some of the test files were not listed in haxl.cabal

Reviewed By: kuk0

Differential Revision: D3951346

fbshipit-source-id: 8e6677a728acde3713c618a6383b2de510b1ac86
2016-09-30 10:01:37 -07:00
Gergely Szilvasy
187bd49f54 increasing version in haxl.cabal
Summary: Increasing package version before uploading on hackage.

Reviewed By: JonCoens

Differential Revision: D3944387

fbshipit-source-id: 146ed68970b7d3d6486b0e10f7d183e60e37257b
2016-09-30 03:16:33 -07:00
Andrew Farmer
528bba5565 Add unit test to demonstrate withLabel with pure/haxl exceptions
Summary:
Labels which throw Haxl exceptions are recorded, but pure exceptions bubble up
and labels are lost. This test demonstrates this.

Reviewed By: simonmar

Differential Revision: D3672479

fbshipit-source-id: fab10878e7eb067e0c65bcf401d75604c333007f
2016-08-22 08:31:36 -07:00
Oleg Grenrus
bc4a25c61e Support aeson-1
Summary: Closes https://github.com/facebook/Haxl/pull/54

Reviewed By: kuk0

Differential Revision: D3696720

Pulled By: niteria

fbshipit-source-id: f04ba17a24a74dcc0de8b1c4336c59e28d5a427d
2016-08-10 08:16:40 -07:00
Gergely Szilvasy
251ad5c3e5 Version bounds on binary package
Summary:
Putting version bounds on binary package in haxl.cabal
Closes https://github.com/facebook/Haxl/pull/48

Reviewed By: watashi

Differential Revision: D3371245

Pulled By: algoriddle

fbshipit-source-id: 574cbbe3ee081bd4e8af7c91fa89cf6ab6a03029
2016-06-07 15:16:29 -07:00
Gergely Szilvasy
1893551564 Unbreak cabal test
Summary: Some tests were failing, but we ignored the test failures by not checking the return value from the test runner. This patch fixes both the test runner and the tests.

Reviewed By: watashi

Differential Revision: D3379609

fbshipit-source-id: 0a1278879faa5beb0f9779ddfaa622cdbf05a73f
2016-06-04 15:31:43 -07:00
Andrew Farmer
b5a305b5c1 Count rounds/fetches for profiling labels.
Summary:
This collects the highest round in which a label adds a fetch, as well as
number of fetches per label per datasource. It reports these, along with
aggregated values with scuba sample of profiling data.

Aggregation for number of rounds is the maximum round of label or any of
label's children. Aggregation for number of fetches is sum.

Reviewed By: simonmar

Differential Revision: D3316018

fbshipit-source-id: 152690c7b8811d22f566437675c943f755029528
2016-06-04 15:20:42 -07:00