Skip to content

Commit efbf4a9

Browse files
authored
Merge branch 'main' into aliases
2 parents 282b018 + 81702c9 commit efbf4a9

File tree

131 files changed

+7005
-2633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+7005
-2633
lines changed

.github/workflows/python.yml

+28-4
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,14 @@ jobs:
8383
python-version: ["3.8", "3.9", "3.10"]
8484

8585
steps:
86+
- name: Set up JDK 8
87+
uses: actions/setup-java@v3
88+
with:
89+
java-version: "8"
90+
distribution: "adopt"
91+
8692
- name: Set Timezone
87-
run: sudo timedatectl set-timezone UTC
93+
run: sudo timedatectl set-timezone UTC && echo UTC | sudo tee /etc/timezone
8894

8995
- uses: actions/checkout@v4
9096
- name: Copy README
@@ -110,8 +116,14 @@ jobs:
110116
runs-on: ubuntu-latest
111117

112118
steps:
119+
- name: Set up JDK 8
120+
uses: actions/setup-java@v3
121+
with:
122+
java-version: "8"
123+
distribution: "adopt"
124+
113125
- name: Set Timezone
114-
run: sudo timedatectl set-timezone UTC
126+
run: sudo timedatectl set-timezone UTC && echo UTC | sudo tee /etc/timezone
115127

116128
- uses: actions/checkout@v4
117129
- name: Copy README
@@ -134,8 +146,14 @@ jobs:
134146
runs-on: ubuntu-latest
135147

136148
steps:
149+
- name: Set up JDK 8
150+
uses: actions/setup-java@v3
151+
with:
152+
java-version: "8"
153+
distribution: "adopt"
154+
137155
- name: Set Timezone
138-
run: sudo timedatectl set-timezone UTC
156+
run: sudo timedatectl set-timezone UTC && echo UTC | sudo tee /etc/timezone
139157

140158
- uses: actions/checkout@v4
141159
- name: Copy README
@@ -161,8 +179,14 @@ jobs:
161179
runs-on: ubuntu-latest
162180

163181
steps:
182+
- name: Set up JDK 8
183+
uses: actions/setup-java@v3
184+
with:
185+
java-version: "8"
186+
distribution: "adopt"
187+
164188
- name: Set Timezone
165-
run: sudo timedatectl set-timezone Europe/Amsterdam
189+
run: sudo timedatectl set-timezone Europe/Amsterdam && echo Europe/Amsterdam | sudo tee /etc/timezone
166190

167191
- uses: actions/checkout@v4
168192
- name: Copy README

CONTRIBUTING.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
We follow a few best practices for writing the Python documentation:
3838

39-
1. Use the google docstring style:
39+
1. Use the Google docstring style:
4040

4141
```python
4242
"""[One Line Summary]
@@ -72,16 +72,17 @@ We use `mkdocs` together with `mike` ([for versioning](https://github.com/jimpor
7272
**Background about `mike`:**
7373
`mike` builds the documentation and commits it as a new directory to the gh-pages branch. Each directory corresponds to one version of the documentation. Additionally, `mike` maintains a json in the root of gh-pages with the mappings of versions/aliases for each of the directories available. With aliases you can define extra names like `dev` or `latest`, to indicate stable and unstable releases.
7474

75-
1. Install Hopsworks with `dev-docs` extras:
75+
1. Install Hopsworks with `requirements-docs.txt`:
7676

7777
```bash
78-
pip install -e ".[dev-docs]"
78+
pip install -r requirements-docs.txt
79+
pip install -e "python[dev]"
7980
```
8081

8182
2. To build the docs, first run the auto doc script:
8283

8384
```bash
84-
python auto_doc.py
85+
python python/auto_doc.py
8586
```
8687

8788
##### Option 1: Build only current version of docs

README.md

+20-8
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,23 @@ data = { "instances": [ model.input_example ] }
164164
predictions = deployment.predict(data)
165165
```
166166

167+
## Usage
168+
169+
Usage data is collected for improving quality of the library.
170+
It is turned on by default if the backend is [Hopsworks Serverless](https://c.app.hopsworks.ai).
171+
To turn it off, use one of the following ways:
172+
```python
173+
# use environment variable
174+
import os
175+
os.environ["ENABLE_HOPSWORKS_USAGE"] = "false"
176+
177+
# use `disable_usage_logging`
178+
import hopsworks
179+
hopsworks.disable_usage_logging()
180+
```
181+
182+
The corresponding source code is in `python/hopsworks_common/usage.py`.
183+
167184
## Tutorials
168185

169186
Need more inspiration or want to learn more about the Hopsworks platform? Check out our [tutorials](https://github.com/logicalclocks/hopsworks-tutorials).
@@ -176,17 +193,12 @@ Documentation is available at [Hopsworks Documentation](https://docs.hopsworks.a
176193

177194
For general questions about the usage of Hopsworks and the Feature Store please open a topic on [Hopsworks Community](https://community.hopsworks.ai/).
178195

179-
Please report any issue using [Github issue tracking](https://github.com/logicalclocks/hopsworks-api/issues).
180-
181-
### Related to Feautre Store API
182-
183-
Please attach the client environment from the output below to your issue, if it is related to Feature Store API:
196+
Please report any issue using [Github issue tracking](https://github.com/logicalclocks/hopsworks-api/issues) and attach the client environment from the output below to your issue:
184197

185198
```python
186199
import hopsworks
187-
import hsfs
188-
hopsworks.login().get_feature_store()
189-
print(hsfs.get_env())
200+
hopsworks.login()
201+
print(hopsworks.get_sdk_info())
190202
```
191203

192204
## Contributing

docs/templates/api/connection.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# Connection API
1+
# Connection
22

3-
## Creation
4-
5-
{{connection_create}}
3+
{{connection}}
64

75
## Properties
86

97
{{connection_properties}}
108

119
## Methods
1210

13-
{{connection_methods}}
11+
{{connection_methods}}

docs/templates/api/connection_api.md

-11
This file was deleted.

docs/templates/api/job.md

-11
This file was deleted.

docs/templates/api/jobs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Jobs API
22

3-
## Handle
3+
## Handle
44

55
{{job_api_handle}}
66

docs/templates/connection_api.md

-11
This file was deleted.

java/beam/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>hsfs-parent</artifactId>
77
<groupId>com.logicalclocks</groupId>
8-
<version>4.0.0-SNAPSHOT</version>
8+
<version>4.1.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

java/beam/src/main/java/com/logicalclocks/hsfs/beam/StreamFeatureGroup.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.logicalclocks.hsfs.OnlineConfig;
2626
import com.logicalclocks.hsfs.StatisticsConfig;
2727
import com.logicalclocks.hsfs.Storage;
28+
import com.logicalclocks.hsfs.StorageConnector;
2829
import com.logicalclocks.hsfs.beam.engine.FeatureGroupEngine;
2930
import com.logicalclocks.hsfs.beam.engine.BeamProducer;
3031
import com.logicalclocks.hsfs.constructor.QueryBase;
@@ -48,7 +49,7 @@ public class StreamFeatureGroup extends FeatureGroupBase<PCollection<Object>> {
4849
public StreamFeatureGroup(FeatureStore featureStore, @NonNull String name, Integer version, String description,
4950
List<String> primaryKeys, List<String> partitionKeys, String hudiPrecombineKey,
5051
boolean onlineEnabled, List<Feature> features, StatisticsConfig statisticsConfig, String onlineTopicName,
51-
String eventTime, OnlineConfig onlineConfig) {
52+
String eventTime, OnlineConfig onlineConfig, StorageConnector storageConnector, String path) {
5253
this();
5354
this.featureStore = featureStore;
5455
this.name = name;
@@ -65,6 +66,8 @@ public StreamFeatureGroup(FeatureStore featureStore, @NonNull String name, Integ
6566
this.onlineTopicName = onlineTopicName;
6667
this.eventTime = eventTime;
6768
this.onlineConfig = onlineConfig;
69+
this.storageConnector = storageConnector;
70+
this.path = path;
6871
}
6972

7073
public StreamFeatureGroup() {

java/flink/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>hsfs-parent</artifactId>
77
<groupId>com.logicalclocks</groupId>
8-
<version>4.0.0-SNAPSHOT</version>
8+
<version>4.1.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

java/flink/src/main/java/com/logicalclocks/hsfs/flink/StreamFeatureGroup.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.logicalclocks.hsfs.OnlineConfig;
2727
import com.logicalclocks.hsfs.StatisticsConfig;
2828
import com.logicalclocks.hsfs.Storage;
29+
import com.logicalclocks.hsfs.StorageConnector;
2930
import com.logicalclocks.hsfs.constructor.QueryBase;
3031

3132
import com.logicalclocks.hsfs.metadata.Statistics;
@@ -54,7 +55,7 @@ public StreamFeatureGroup(FeatureStore featureStore, @NonNull String name, Integ
5455
List<String> primaryKeys, List<String> partitionKeys, String hudiPrecombineKey,
5556
boolean onlineEnabled, List<Feature> features, StatisticsConfig statisticsConfig,
5657
String onlineTopicName, String topicName, String notificationTopicName, String eventTime,
57-
OnlineConfig onlineConfig) {
58+
OnlineConfig onlineConfig, StorageConnector storageConnector, String path) {
5859
this();
5960
this.featureStore = featureStore;
6061
this.name = name;
@@ -73,6 +74,8 @@ public StreamFeatureGroup(FeatureStore featureStore, @NonNull String name, Integ
7374
this.notificationTopicName = notificationTopicName;
7475
this.eventTime = eventTime;
7576
this.onlineConfig = onlineConfig;
77+
this.storageConnector = storageConnector;
78+
this.path = path;
7679
}
7780

7881
public StreamFeatureGroup() {

java/hsfs/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>hsfs-parent</artifactId>
77
<groupId>com.logicalclocks</groupId>
8-
<version>4.0.0-SNAPSHOT</version>
8+
<version>4.1.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

java/hsfs/src/main/java/com/logicalclocks/hsfs/FeatureGroupBase.java

+8
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ public abstract class FeatureGroupBase<T> {
132132
@Setter
133133
protected OnlineConfig onlineConfig;
134134

135+
@Getter
136+
@Setter
137+
protected StorageConnector storageConnector;
138+
139+
@Getter
140+
@Setter
141+
protected String path;
142+
135143
@JsonIgnore
136144
// These are only used in the client. In the server they are aggregated in the `features` field
137145
protected List<String> partitionKeys;

java/hsfs/src/main/java/com/logicalclocks/hsfs/StorageConnector.java

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ public static class S3Connector extends StorageConnector {
124124
@Getter @Setter
125125
protected String bucket;
126126

127+
@Getter @Setter
128+
protected String region;
129+
127130
@Getter @Setter
128131
protected String sessionToken;
129132

java/hsfs/src/main/java/com/logicalclocks/hsfs/engine/FeatureGroupUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static Long getTimeStampFromDateString(String inputDate) throws FeatureSt
128128
}
129129

130130
SimpleDateFormat dateFormat = new SimpleDateFormat(dateFormatPattern);
131-
Long commitTimeStamp = dateFormat.parse(tempDate).getTime();;
131+
Long commitTimeStamp = dateFormat.parse(tempDate).getTime();
132132

133133
return commitTimeStamp;
134134
}

java/hsfs/src/main/java/com/logicalclocks/hsfs/metadata/HopsworksHttpClient.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
import org.apache.http.HttpRequest;
2323
import org.apache.http.client.ResponseHandler;
2424
import org.slf4j.Logger;
25+
import org.slf4j.LoggerFactory;
2526

2627
import java.io.File;
2728
import java.io.IOException;
29+
import java.nio.charset.Charset;
2830

2931
public interface HopsworksHttpClient {
30-
static final Logger LOGGER = null;
32+
Logger LOGGER = LoggerFactory.getLogger(HopsworksHttpClient.class);
3133

3234
<T> T handleRequest(HttpRequest request, ResponseHandler<T> responseHandler)
3335
throws IOException, FeatureStoreException;
@@ -46,7 +48,7 @@ <T> T handleRequest(HttpRequest request, ResponseHandler<T> responseHandler)
4648

4749
static String readCertKey(String materialPwd) {
4850
try {
49-
return FileUtils.readFileToString(new File(materialPwd));
51+
return FileUtils.readFileToString(new File(materialPwd), Charset.defaultCharset());
5052
} catch (IOException ex) {
5153
LOGGER.warn("Failed to get cert password.", ex);
5254
}

java/hsfs/src/test/java/com/logicalclocks/hsfs/metadata/TestHopsworksClient.java

+8
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,12 @@ public void testStringEntitySerialization() throws IOException {
4646
Assertions.assertEquals("{\"email\":\"test@test.com\",\"firstName\":\"test\",\"lastName\":\"de la Rúa Martínez\"}",
4747
json);
4848
}
49+
50+
// FSTORE-1562: readCertKey throws NullPointerException if
51+
@Test
52+
public void testReadCertKey_failure() {
53+
String key = HopsworksHttpClient.readCertKey("/this/path/does/not/exists");
54+
Assertions.assertNull(key);
55+
}
56+
4957
}

java/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>com.logicalclocks</groupId>
88
<artifactId>hsfs-parent</artifactId>
99
<packaging>pom</packaging>
10-
<version>4.0.0-SNAPSHOT</version>
10+
<version>4.1.0-SNAPSHOT</version>
1111
<modules>
1212
<module>hsfs</module>
1313
<module>spark</module>

java/spark/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<artifactId>hsfs-parent</artifactId>
2424
<groupId>com.logicalclocks</groupId>
25-
<version>4.0.0-SNAPSHOT</version>
25+
<version>4.1.0-SNAPSHOT</version>
2626
</parent>
2727
<modelVersion>4.0.0</modelVersion>
2828

java/spark/src/main/java/com/logicalclocks/hsfs/spark/ExternalFeatureGroup.java

-8
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@
5757
@JsonIgnoreProperties(ignoreUnknown = true)
5858
public class ExternalFeatureGroup extends FeatureGroupBase<Dataset<Row>> {
5959

60-
@Getter
61-
@Setter
62-
private StorageConnector storageConnector;
63-
6460
@Getter
6561
@Setter
6662
private String query;
@@ -69,10 +65,6 @@ public class ExternalFeatureGroup extends FeatureGroupBase<Dataset<Row>> {
6965
@Setter
7066
private ExternalDataFormat dataFormat;
7167

72-
@Getter
73-
@Setter
74-
private String path;
75-
7668
@Getter
7769
@Setter
7870
private List<OnDemandOptions> options;

0 commit comments

Comments
 (0)