Skip to content

Commit caf2702

Browse files
committed
inconsistency warning msg fixes
1 parent bcbc666 commit caf2702

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

zephyr_ml/core.py

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,16 @@ def try_perform_inconsistent_producer_step( # add using stale and overwriting
222222
prev_set_method = self.or_join(self.ordered_steps[prev_step][1])
223223
prev_key_method = self.or_join(self.ordered_steps[prev_step][0])
224224
LOGGER.warning(f"[GUIDE] INCONSISTENCY WARNING:\n"
225-
f"\tUnable to perform {name} because you are performing a key method at"
226-
f"step {next_step} but the result of the previous step,"
227-
f"step {prev_step}, is stale.\n"
228-
f"\tIf you want to use the stale result or"
229-
f"already have the data for step {next_step}, you can use the"
225+
f"\tUnable to perform {name} because you are "
226+
f"performing a key method at step {next_step} but the result of the "
227+
f"previous step, step {prev_step}, is stale.\n"
228+
f"\tIf you want to use the stale result or "
229+
f"already have the data for step {prev_step}, you can use the "
230230
f"corresponding set method: {prev_set_method}.\n"
231-
f"\tIf you already have the data for THIS step, you can call"
231+
f"\tIf you already have the data for THIS step, you can call "
232232
f"{corr_set_method} to set the data.\n"
233-
f"\tOtherwise, you can regenerate the data of the"
234-
f"previous step by calling {prev_key_method},"
233+
f"\tOtherwise, you can regenerate the data of the "
234+
f"previous step by calling {prev_key_method}, "
235235
f"and then recall this method.")
236236
elif (next_step < self.current_step and
237237
self.iterations[next_step - 1] != self.cur_iteration):
@@ -240,17 +240,17 @@ def try_perform_inconsistent_producer_step( # add using stale and overwriting
240240
corr_set_method = self.or_join(self.ordered_steps[next_step][1])
241241
prev_set_method = self.or_join(self.ordered_steps[prev_step][1])
242242
LOGGER.warning(f"[GUIDE] INCONSISTENCY WARNING:\n"
243-
f"\tUnable to perform {name} because"
244-
f"you are going backwards and starting a new iteration by"
245-
f"performing a key method at step {next_step} but the result of the"
243+
f"\tUnable to perform {name} because "
244+
f"you are going backwards and starting a new iteration by "
245+
f"performing a key method at step {next_step} but the result of the "
246246
f"previous step, step {prev_step}, is STALE.\n"
247-
f"\tIf you want to use the STALE result or"
248-
f"already have the data for step {next_step}, you can use the"
247+
f"\tIf you want to use the STALE result or "
248+
f"already have the data for step {prev_step}, you can use the "
249249
f"corresponding set method: {prev_set_method}.\n"
250-
f"\tIf you already have the data for THIS step, you can call"
250+
f"\tIf you already have the data for THIS step, you can call "
251251
f"{corr_set_method} to set the data.\n"
252-
f"\tOtherwise, you can regenerate the data of the"
253-
f"previous step by calling {prev_key_method},"
252+
f"\tOtherwise, you can regenerate the data of the "
253+
f"previous step by calling {prev_key_method}, "
254254
f"and then recall this method."
255255
)
256256

@@ -415,7 +415,16 @@ def generate_entityset(
415415
416416
Returns:
417417
featuretools.EntitySet: EntitySet containing the processed data and relationships.
418+
419+
Raises:
420+
ValueError: If the entityset type is invalid OR
421+
if the entityset does not follow the data input rules.
418422
"""
423+
if es_type not in VALIDATE_DATA_FUNCTIONS:
424+
raise ValueError(
425+
f"Invalid entityset type: {es_type}. Please use one of the following types:\
426+
{VALIDATE_DATA_FUNCTIONS.keys()}")
427+
419428
entityset = _create_entityset(dfs, es_type, custom_kwargs_mapping)
420429

421430
# perform signal processing
@@ -438,19 +447,26 @@ def generate_entityset(
438447
return self._entityset
439448

440449
@guide
441-
def set_entityset(self, entityset=None, es_type=None, entityset_path=None,
450+
def set_entityset(self, es_type, entityset=None, entityset_path=None,
442451
custom_kwargs_mapping=None):
443452
"""Set the entityset for this Zephyr instance.
444453
445454
Args:
455+
es_type (str): The type of entityset (pi/scada/vibrations).
446456
entityset (featuretools.EntitySet, optional): An existing entityset to use.
447-
es_type (str, optional): The type of entityset (pi/scada/vibrations).
448457
entityset_path (str, optional): Path to a saved entityset to load.
449458
custom_kwargs_mapping (dict, optional): Custom keyword arguments for validation.
450459
451460
Raises:
452-
ValueError: If no entityset is provided through any of the parameters.
461+
ValueError: If no entityset is provided through any of the parameters OR
462+
if the entityset type is invalid OR
463+
if the entityset does not follow the data input rules.
453464
"""
465+
if es_type not in VALIDATE_DATA_FUNCTIONS:
466+
raise ValueError(
467+
f"Invalid entityset type: {es_type}. Please use one of the following types:\
468+
{VALIDATE_DATA_FUNCTIONS.keys()}")
469+
454470
if entityset_path is not None:
455471
entityset = ft.read_entityset(entityset_path)
456472

0 commit comments

Comments
 (0)