CommunityData:Hyak Datasets

This page is for documenting datasets available on Hyak and how to use them.

= Datasets =

Reddit
We maintain an archive of Reddit submissions and comments going back to Reddit's early history that is up-do-date with January 2019 (for comments) and August 2019 (for submissions). We have copies of dumps collected and published by pushshift and tabular datasets derived from them. Compared to obtaining data from the Reddit (or pushshift) APIs, working with these archival datasets will be faster and less work for you. The tabular datasets in particular are quite fast thanks to the parquet file format making it possible to pull subsets of the data (e.g. complete history of a subreddit) in as little as 15 minutes. In contrast it takes about a day to extract and parse the dumps on a mox node.

Code for this project is located in the (currently private) cdsc_reddit git repository on code.communitydata.science.

For computational efficiency it is best to parse the dumps as little as possible. So if it is possible for you to work with the tabular datasets, please do so. The tabular datasets currently have the variables that most projects will want to use, but there are many other metadata variables including ones related to moderation, media, Reddit gold and more. If you want a variable from the pushshift json that isn't in parquet tables, don't fret! It will not be too much work to add it. Reach out to Nate.

The parquet datasets are located at

" " and " " refer to how the data is partitioned and sorted. This has important performance implications because filtering by partition column is fast. Spark can also make good use of the sorting to make joins and groupbys faster. These datasets are also designed to stream one user/author or subreddit at a time to support building subreddit or author level variables. All of the datasets have  as a secondary sort so posts and comments by an author or subreddit are read in chronological order.

Reading Reddit parquet datasets
The recommended way to pull data from parquet on Hyak is to use pyarrow, which makes it relatively easy to filter the data and load it into Pandas. The main alternative is Spark, which is a more complex and less efficient system, but can read and write parquet and is useful for working with data that is too large to fit in memory.

Arrow bindings for R are available, but as of Arrow 0.17.1 it's complicated to install them on Hyak. 

This example loads all comments to the Seattle subreddit. You should try it out!

Parquet is a column-oriented format which means that it is capable of reading each column independently of others. This confers two key advantages compared to unstructured formats that can make it very fast. First, the  runs only on the   column to figure out what rows need to be read for the other fields. Second, only the columns that are selected in  need to be read at all. This is how arrow can pull data from parquet so fast.

Streaming parquet datasets
If the data you want to pull exceed available memory, you have a few options.

One option is to just use Spark which is likely a good option if you want to do large and complex joins or group-bys. Downsides of Spark include issues of stability and complexity. Spark is capable, can be fast, and can scale to many nodes, but it can also crash and be complex to program.

An alternative is to stream data from parquet using pyarrow. Pyarrow can load a large dataset one chunk at a time and you can turn these chunks into stream of rows. The stream of rows will have the same order as the data on disk. In the example below the datasets are partitoned by author and the partitions are sorted so edits can be read one author at a time. This is convenient as a starting point for building author-level variables.

Install Arrow for R
If you want to use Arrow in R and your R on Hyak doesn't already have Arrow installed, follow these steps. On computers not running CentOS you'll probably be fine just running. These instructions are derived from this debugging session on the Arrow bug tracker.

First you need to load a modern cmake and set some environment variables.

Now, start R and download (not install!) the  package.

Now, you need to unpack  and edit.

In, modify the value of   and set it to.

Finally, go back into R and finish installing arrow.

Wikia / Fandom
CommunityData:Wikia_data contains some information about where this data comes from.

Locations: