-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add historical retrieval via job service #1107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ option java_package = "feast.proto.core"; | |
|
|
||
| import "google/protobuf/timestamp.proto"; | ||
| import "feast/core/DataSource.proto"; | ||
| import "feast/serving/ServingService.proto"; | ||
|
|
||
|
|
||
| service JobService { | ||
| // Start job to ingest data from offline store into online store | ||
|
|
@@ -38,8 +38,8 @@ service JobService { | |
| // List all types of jobs | ||
| rpc ListJobs (ListJobsRequest) returns (ListJobsResponse); | ||
|
|
||
| // Stop a single job | ||
| rpc StopJob (StopJobRequest) returns (StopJobResponse); | ||
| // Cancel a single job | ||
| rpc CancelJob (CancelJobRequest) returns (CancelJobResponse); | ||
|
|
||
| // Get details of a single job | ||
| rpc GetJob (GetJobRequest) returns (GetJobResponse); | ||
|
|
@@ -48,9 +48,9 @@ service JobService { | |
|
|
||
| enum JobType { | ||
| INVALID_JOB = 0; | ||
| OFFLINE_TO_ONLINE_JOB = 1; | ||
| STREAM_TO_ONLINE_JOB = 2; | ||
| EXPORT_JOB = 4; | ||
| BATCH_INGESTION_JOB = 1; | ||
| STREAM_INGESTION_JOB = 2; | ||
| RETRIEVAL_JOB = 4; | ||
|
woop marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| enum JobStatus { | ||
|
|
@@ -68,42 +68,26 @@ enum JobStatus { | |
| message Job { | ||
| // Identifier of the Job | ||
| string id = 1; | ||
| // External Identifier of the Job assigned by the Spark executor | ||
| string external_id = 2; | ||
| // Type of the Job | ||
| JobType type = 3; | ||
| JobType type = 2; | ||
| // Current job status | ||
| JobStatus status = 4; | ||
| // Timestamp on when the job was is created | ||
| google.protobuf.Timestamp created_timestamp = 5; | ||
| // Timestamp on when the job has stopped. | ||
| google.protobuf.Timestamp stop_timestamp = 6; | ||
|
|
||
| message ExportJobMeta { | ||
| // Glob of the exported files that should be retrieved to reconstruct | ||
| // the dataframe with retrieved features. | ||
| repeated string file_glob = 1; | ||
| // The Historical Features request that triggered this export job | ||
| GetHistoricalFeaturesRequest request = 2; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed a bunch of unused (or not yet used) parameters here, we can always add them back later. |
||
| JobStatus status = 3; | ||
|
|
||
| message RetrievalJobMeta { | ||
| string output_location = 4; | ||
| } | ||
|
|
||
| message OfflineToOnlineMeta { | ||
| // Reference to the Feature Table being populated by this job | ||
| string project = 1; | ||
| string table_name = 2; | ||
| } | ||
|
|
||
| message StreamToOnlineMeta { | ||
| // Reference to the Feature Table being populated by this job | ||
| string project = 1; | ||
| string table_name = 2; | ||
| } | ||
|
|
||
| // JobType specific metadata on the job | ||
| oneof meta { | ||
| ExportJobMeta export = 7; | ||
| OfflineToOnlineMeta offline_to_online = 8; | ||
| StreamToOnlineMeta stream_to_online = 9; | ||
| RetrievalJobMeta retrieval = 5; | ||
| OfflineToOnlineMeta batch_ingestion = 6; | ||
| StreamToOnlineMeta stream_ingestion = 7; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -127,13 +111,13 @@ message StartOfflineToOnlineIngestionJobResponse { | |
|
|
||
| message GetHistoricalFeaturesRequest { | ||
| // List of features that are being retrieved | ||
| repeated feast.serving.FeatureReferenceV2 features = 1; | ||
| repeated string feature_refs = 1; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed this for consistency with client API |
||
|
|
||
| // Batch DataSource that can be used to obtain entity values for historical retrieval. | ||
| // For each entity value, a feature value will be retrieved for that value/timestamp | ||
| // Only 'BATCH_*' source types are supported. | ||
| // Currently only BATCH_FILE source type is supported. | ||
| DataSource entities_source = 2; | ||
| DataSource entity_source = 2; | ||
|
|
||
| // Optional field to specify project name override. If specified, uses the | ||
| // given project for retrieval. Overrides the projects specified in | ||
|
|
@@ -143,12 +127,13 @@ message GetHistoricalFeaturesRequest { | |
| // Specifies the path in a bucket to write the exported feature data files | ||
| // Export to AWS S3 - s3://path/to/features | ||
| // Export to GCP GCS - gs://path/to/features | ||
| string destination_path = 4; | ||
| string output_location = 4; | ||
| } | ||
|
|
||
| message GetHistoricalFeaturesResponse { | ||
| // Export Job with ID assigned by Feast | ||
| string id = 1; | ||
| string output_file_uri = 2; | ||
| } | ||
|
|
||
| message StartStreamToOnlineIngestionJobRequest { | ||
|
|
@@ -163,13 +148,7 @@ message StartStreamToOnlineIngestionJobResponse { | |
| } | ||
|
|
||
| message ListJobsRequest { | ||
| Filter filter = 1; | ||
| message Filter { | ||
| // Filter jobs by job type | ||
| JobType type = 1; | ||
| // Filter jobs by current job status | ||
| JobStatus status = 2; | ||
| } | ||
| bool include_terminated = 1; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. another change for consistency with client API |
||
| } | ||
|
|
||
| message ListJobsResponse { | ||
|
|
@@ -184,14 +163,8 @@ message GetJobResponse { | |
| Job job = 1; | ||
| } | ||
|
|
||
| message RestartJobRequest { | ||
| string job_id = 1; | ||
| } | ||
|
|
||
| message RestartJobResponse {} | ||
|
|
||
| message StopJobRequest{ | ||
| message CancelJobRequest{ | ||
| string job_id = 1; | ||
| } | ||
|
|
||
| message StopJobResponse {} | ||
| message CancelJobResponse {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -471,8 +471,16 @@ def list_jobs(): | |
| help="Path to entity df in CSV format. It is assumed to have event_timestamp column and a header.", | ||
| required=True, | ||
| ) | ||
| @click.option( | ||
| "--entity-df-dtype", | ||
| "-d", | ||
| help="Dtypes for entity df, in JSON format", | ||
| required=False, | ||
| ) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't expect people to use this in production, but it is handy for debugging. |
||
| @click.option("--destination", "-d", help="Destination", default="") | ||
| def get_historical_features(features: str, entity_df_path: str, destination: str): | ||
| def get_historical_features( | ||
| features: str, entity_df_path: str, entity_df_dtype: str, destination: str | ||
| ): | ||
| """ | ||
| Get historical features | ||
| """ | ||
|
|
@@ -481,7 +489,14 @@ def get_historical_features(features: str, entity_df_path: str, destination: str | |
| client = Client() | ||
|
|
||
| # TODO: clean this up | ||
| entity_df = pandas.read_csv(entity_df_path, sep=None, engine="python",) | ||
|
|
||
| if entity_df_dtype: | ||
| dtype = json.loads(entity_df_dtype) | ||
| entity_df = pandas.read_csv( | ||
| entity_df_path, sep=None, engine="python", dtype=dtype | ||
| ) | ||
| else: | ||
| entity_df = pandas.read_csv(entity_df_path, sep=None, engine="python") | ||
|
|
||
| entity_df["event_timestamp"] = pandas.to_datetime(entity_df["event_timestamp"]) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,7 +116,7 @@ class AuthProvider(Enum): | |
| # Path to certificate(s) to secure connection to Feast Serving | ||
| CONFIG_SERVING_SERVER_SSL_CERT_KEY: "", | ||
| # Default connection timeout to Feast Serving and Feast Core (in seconds) | ||
| CONFIG_GRPC_CONNECTION_TIMEOUT_DEFAULT_KEY: "3", | ||
| CONFIG_GRPC_CONNECTION_TIMEOUT_DEFAULT_KEY: "10", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had to bump this since some job service methods in turn make calls to AWS/GCP APIs. Sometimes those take a while especially in development env where your job service is not running in the cloud itself. |
||
| # Default gRPC connection timeout when sending an ApplyFeatureSet command to | ||
| # Feast Core (in seconds) | ||
| CONFIG_GRPC_CONNECTION_TIMEOUT_APPLY_KEY: "600", | ||
|
|
@@ -133,4 +133,8 @@ class AuthProvider(Enum): | |
| CONFIG_REDIS_SSL: "False", | ||
| CONFIG_SPARK_HISTORICAL_FEATURE_OUTPUT_FORMAT: "parquet", | ||
| CONFIG_SPARK_EXTRA_OPTIONS: "", | ||
| # Enable or disable TLS/SSL to Feast Service | ||
| CONFIG_JOB_SERVICE_ENABLE_SSL_KEY: "False", | ||
| # Path to certificate(s) to secure connection to Feast Job Service | ||
| CONFIG_JOB_SERVICE_SERVER_SSL_CERT_KEY: "", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should prob unify those params with core service in another PR. |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed this for consistency with the existing Job.cancel method