Slackbot
10/05/2022, 9:52 PMAaron Pham
10/05/2022, 9:53 PMAaron Pham
10/05/2022, 9:54 PMMike Kuhlen
10/05/2022, 9:54 PMMike Kuhlen
10/05/2022, 9:54 PMAaron Pham
10/05/2022, 9:56 PMpytest_collection_modifyitems
def pytest_collection_modifyitems(
session: Session, config: Config, items: list[Item]
) -> None:
subprocess.check_call([sys.executable, f"{os.path.join(PROJECT_DIR, 'train.py')}"])
Aaron Pham
10/05/2022, 9:56 PMtrain.py
if __name__ == "__main__":
import python_model
import bentoml
bentoml.picklable_model.save_model(
"py_model.case-1.grpc.e2e",
python_model.PythonFunction(),
signatures={
"predict_file": {"batchable": True},
"echo_json": {"batchable": True},
"echo_object": {"batchable": False},
"echo_ndarray": {"batchable": True},
"double_ndarray": {"batchable": True},
"multiply_float_ndarray": {"batchable": True},
"double_dataframe_column": {"batchable": True},
},
external_modules=[python_model],
)
Aaron Pham
10/05/2022, 9:57 PMbentoml/testing/server.py
you can find functions that can help you with creating bentos and setup the whole testing lifecycle
https://github.com/bentoml/BentoML/blob/632141f197e7e3415781f7545039f318975238de/bentoml/testing/server.py#L428Aaron Pham
10/05/2022, 9:58 PMMike Kuhlen
10/05/2022, 9:59 PMAaron Pham
10/05/2022, 9:59 PMAaron Pham
10/05/2022, 10:00 PM-p no:name
pytest -p no:bentoml ...
Mike Kuhlen
10/05/2022, 10:01 PMbut that creates a limitation where you can’t test your current bentoyeah, that’s a problem for the CI pipeline that I’m building. Basically I’m doing: • import models • bentoml build • run tests (
python -m pytest tests/
)
• push to yatai
And that’s been working great! Until 1.0.7…Mike Kuhlen
10/05/2022, 10:01 PMwhat you can do for now is to pass in-p no:name
Thanks, lemme try that.Copy codepytest -p no:bentoml ...
Aaron Pham
10/05/2022, 10:01 PMMike Kuhlen
10/05/2022, 10:02 PM-p no:name
works for me, that unblocks me.Aaron Pham
10/05/2022, 10:10 PM