-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PUBDEV-5429: Add support for ingesting from multiple directories + sp…
…eedup (#2653) This change also improves performance of ingest when importing from large number of source files / directories. Previous implementation was sequential and resulted in a single request per source. This is especially bad for HTTP ingest which is done eagerly. Current implementation does a single request for all the files. Loading is paralellized on a single node (not distributed - typically not necessary).
- Loading branch information
michalkurka
committed
Jul 18, 2018
1 parent
4740d86
commit 95af092
Showing
7 changed files
with
158 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
h2o-core/src/main/java/water/api/schemas3/ImportFilesMultiV3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package water.api.schemas3; | ||
|
||
import water.Iced; | ||
import water.api.API; | ||
|
||
public class ImportFilesMultiV3 extends RequestSchemaV3<ImportFilesMultiV3.ImportFilesMulti, ImportFilesMultiV3> { | ||
|
||
public final static class ImportFilesMulti extends Iced<ImportFilesMulti> { | ||
public String[] paths; | ||
public String pattern; | ||
public String files[]; | ||
public String destination_frames[]; | ||
public String fails[]; | ||
public String dels[]; | ||
} | ||
|
||
// Input fields | ||
@API(help = "paths", required = true) | ||
public String[] paths; | ||
|
||
@API(help = "pattern", direction = API.Direction.INPUT) | ||
public String pattern; | ||
|
||
// Output fields | ||
@API(help = "files", direction = API.Direction.OUTPUT) | ||
public String files[]; | ||
|
||
@API(help = "names", direction = API.Direction.OUTPUT) | ||
public String destination_frames[]; | ||
|
||
@API(help = "fails", direction = API.Direction.OUTPUT) | ||
public String fails[]; | ||
|
||
@API(help = "dels", direction = API.Direction.OUTPUT) | ||
public String dels[]; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from __future__ import print_function | ||
import sys | ||
sys.path.insert(1,"../../") | ||
import h2o | ||
from tests import pyunit_utils | ||
|
||
# test that h2o.import_file works on multiple sources | ||
def import_multi(): | ||
airlines = h2o.import_file(path=[ | ||
pyunit_utils.locate("smalldata/testng/airlines_train.csv"), | ||
pyunit_utils.locate("smalldata/testng/airlines_test.csv") | ||
]) | ||
|
||
assert airlines.nrows == 24421 + 2691 | ||
|
||
if __name__ == "__main__": | ||
pyunit_utils.standalone_test(import_multi) | ||
else: | ||
import_multi() |