Skip to content
Snippets Groups Projects

Draft: Partition parquet dataset for sync with s5cmd

Closed Matthew K Defenderfer requested to merge partition-parquet-dataset into main
1 file
+ 4
8
Compare changes
  • Side-by-side
  • Inline
@@ -34,16 +34,12 @@ def main():
ddf = dd.read_parquet(input_parquet)
ddf = ddf.loc[ddf['path'].str.startswith(filter)].sort_values('path')
ddf = ddf.loc[~ddf['mode'].str.startswith('d')].reset_index(drop=True)
ddf['group'] = np.floor(ddf.index/split_count).astype(int) + 1
ddf = ddf.loc[~ddf['mode'].str.startswith('d')]
ddf['cmd'] = ddf['path'].map(lambda x: create_sync_cmd(x, filter=filter, dest=dest), meta=str)
df = ddf[['group','cmd']].compute()
df = ddf[['cmd']].compute().reset_index(drop=True)
df['group'] = np.floor(df.index/split_count).astype(int) + 1
os.makedirs(part_dir,exist_ok=True)
Loading