Skip to content

Commit 8a86c86

Browse files
committed
chore: misc cleanup
1 parent 5226d24 commit 8a86c86

File tree

1 file changed

+1
-86
lines changed

1 file changed

+1
-86
lines changed

src/sasctl/tasks.py

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
from .services import model_management as mm
3131
from .services import model_publish as mp
3232
from .services import model_repository as mr
33-
from .utils.misc import installed_packages
34-
from .utils.pymas import from_pickle
33+
3534

3635
logger = logging.getLogger(__name__)
3736

@@ -501,91 +500,7 @@ def register_model(
501500
model_file_name=list(pickled_model.keys())[0])
502501
return model_obj
503502

504-
# # If the model is a scikit-learn model, generate the model dictionary
505-
# # from it and pickle the model for storage
506-
# if all(hasattr(model, attr) for attr in ["_estimator_type", "get_params"]):
507-
# # Pickle the model so we can store it
508-
# model_pkl = pickle.dumps(model)
509-
# files.append({"name": "model.pkl", "file": model_pkl, "role": "Python Pickle"})
510-
#
511-
# target_funcs = [f for f in ("predict", "predict_proba") if hasattr(model, f)]
512-
#
513-
# # Extract model properties
514-
# model = _sklearn_to_dict(model)
515-
# model["name"] = name
516-
#
517-
# # Get package versions in environment
518-
# packages = installed_packages()
519-
# if record_packages and packages is not None:
520-
# model.setdefault("properties", [])
521-
#
522-
# # Define a custom property to capture each package version
523-
# # NOTE: some packages may not conform to the 'name==version' format
524-
# # expected here (e.g those installed with pip install -e). Such
525-
# # packages also generally contain characters that are not allowed
526-
# # in custom properties, so they are excluded here.
527-
# for p in packages:
528-
# if "==" in p:
529-
# n, v = p.split("==")
530-
# model["properties"].append(_property("env_%s" % n, v))
531-
#
532-
# # Generate and upload a requirements.txt file
533-
# files.append({"name": "requirements.txt", "file": "\n".join(packages)})
534-
#
535-
# # Generate PyMAS wrapper
536-
# try:
537-
# mas_module = from_pickle(
538-
# model_pkl, target_funcs, input_types=input, array_input=True
539-
# )
540-
#
541-
# # Include score code files from ESP and MAS
542-
# files.append(
543-
# {
544-
# "name": "dmcas_packagescorecode.sas",
545-
# "file": mas_module.score_code(),
546-
# "role": "Score Code",
547-
# }
548-
# )
549-
# files.append(
550-
# {
551-
# "name": "dmcas_epscorecode.sas",
552-
# "file": mas_module.score_code(dest="CAS"),
553-
# "role": "score",
554-
# }
555-
# )
556-
# files.append(
557-
# {
558-
# "name": "python_wrapper.py",
559-
# "file": mas_module.score_code(dest="Python"),
560-
# }
561-
# )
562-
#
563-
# model["inputVariables"] = [
564-
# var.as_model_metadata() for var in mas_module.variables if not var.out
565-
# ]
566-
#
567-
# model["outputVariables"] = [
568-
# var.as_model_metadata() for var in mas_module.variables if var.out
569-
# ]
570-
# except ValueError:
571-
# # PyMAS creation failed, most likely because input data wasn't
572-
# # provided
573-
# logger.exception("Unable to inspect model %s", model)
574-
#
575-
# warn(
576-
# "Unable to determine input/output variables. "
577-
# " Model variables will not be specified and some "
578-
# "model functionality may not be available."
579-
# )
580-
# else:
581-
# # Otherwise, the model better be a dictionary of metadata
582-
# if not isinstance(model, dict):
583-
# raise TypeError(
584-
# "Expected an instance of '%r' but received '%r'." % ({}, model)
585-
# )
586-
587503
# If we got this far, then `model` is a dictionary of model metadata.
588-
589504
if create_project:
590505
project = _create_project(project, model, repo_obj)
591506

0 commit comments

Comments
 (0)