Skip to content

Commit 86653bc

Browse files
gustavocidornelaswhoseoyster
authored andcommitted
Fix buggy validation for publish_batch_data and stream_data
1 parent 6728b57 commit 86653bc

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

openlayer/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,22 +1208,23 @@ def publish_batch_data(
12081208
def _validate_production_data_and_load_config(
12091209
self,
12101210
task_type: TaskType,
1211-
config: Dict[str, any],
1212-
config_file_path: str,
12131211
df: pd.DataFrame,
1212+
config: Optional[Dict[str, any]] = None,
1213+
config_file_path: Optional[str] = None,
12141214
) -> Dict[str, any]:
12151215
"""Validates the production data and its config and returns a valid config
12161216
populated with the default values."""
12171217
if config is None and config_file_path is None:
12181218
raise ValueError(
12191219
"Either the config or the config file path must be provided."
12201220
)
1221-
if config_file_path is not None and not os.path.exists(config_file_path):
1222-
raise exceptions.OpenlayerValidationError(
1223-
f"The file specified by the config file path {config_file_path} does"
1224-
" not exist."
1225-
) from None
1226-
elif config_file_path is not None:
1221+
1222+
if config_file_path is not None:
1223+
if not os.path.exists(config_file_path):
1224+
raise exceptions.OpenlayerValidationError(
1225+
f"The file specified by the config file path {config_file_path} does"
1226+
" not exist."
1227+
) from None
12271228
config = utils.read_yaml(config_file_path)
12281229

12291230
# Force label to be production
@@ -1233,7 +1234,6 @@ def _validate_production_data_and_load_config(
12331234
validator = dataset_validators.get_validator(
12341235
task_type=task_type,
12351236
dataset_config=config,
1236-
dataset_config_file_path=config_file_path,
12371237
dataset_df=df,
12381238
)
12391239
failed_validations = validator.validate()

openlayer/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
data=data,
2323
)
2424
"""
25-
__version__ = "0.1.0a18"
25+
__version__ = "0.1.0a19"

0 commit comments

Comments
 (0)