Skip to content

Commit

Permalink
Adding DeprecationWarning for mpc services in fbpcp
Browse files Browse the repository at this point in the history
Summary:
## Why
welcome_to_meta_road_deprecated

Differential Revision: D41228073

fbshipit-source-id: 6192bd65c7d2662d721079e49c608cd94788dcbc
  • Loading branch information
joe1234wu authored and facebook-github-bot committed Nov 11, 2022
1 parent 36dd167 commit 68ce780
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
9 changes: 9 additions & 0 deletions fbpcp/service/mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import logging
from typing import Any, Dict, List, Optional

from warnings import warn

from fbpcp.entity.certificate_request import CertificateRequest

from fbpcp.entity.container_instance import ContainerInstance, ContainerInstanceStatus
Expand Down Expand Up @@ -43,6 +45,13 @@ def __init__(
task_definition -- containers task definition
mpc_game_svc -- service to generate package name and game arguments.
"""

warn(
f"{self.__class__.__name__} has been moved to fbpcs repo.",
DeprecationWarning,
stacklevel=2,
)

if container_svc is None or instance_repository is None or mpc_game_svc is None:
raise ValueError(
f"Dependency is missing. container_svc={container_svc}, mpc_game_svc={mpc_game_svc}, "
Expand Down
6 changes: 6 additions & 0 deletions fbpcp/service/mpc_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import logging
from typing import Any, Dict, Optional, Tuple
from warnings import warn

from fbpcp.entity.mpc_game_config import MPCGameConfig
from fbpcp.entity.mpc_instance import MPCParty
Expand All @@ -20,6 +21,11 @@

class MPCGameService:
def __init__(self, mpc_game_repository: MPCGameRepository) -> None:
warn(
f"{self.__class__.__name__} has been moved to fbpcs repo.",
DeprecationWarning,
stacklevel=2,
)
self.logger: logging.Logger = logging.getLogger(__name__)
self.mpc_game_repository: MPCGameRepository = mpc_game_repository

Expand Down
7 changes: 4 additions & 3 deletions tests/service/test_mpc_do_not_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# This test file is a short-term to freeze the file change during migration.
# After migration completed, we shall delete this ut test
# TODO: T137598681 clean up FBPCS mpc related files after migration complete
# NOTE: please make further change on fbcode/fbpcs/private_computation/service/mpc/
#############################################################################
import hashlib
import inspect
Expand All @@ -27,15 +28,15 @@
NO_CHANGE_FILES = (
{
"cls": MPCService,
"file_md5": "35dbe2a73b1016d6d631b03abc612929",
"file_md5": "c95dfc0001cba26e1b359c4f77b85c4f",
},
{
"cls": TestMPCService,
"file_md5": "6a1c7a74f28d164e113b68dbcab29962",
},
{
"cls": MPCGameService,
"file_md5": "36a2142e36759e382855e970f12c7403",
"file_md5": "3797201816cf9dd16369b5cf0703ec54",
},
{
"cls": TestMPCGameService,
Expand Down Expand Up @@ -68,7 +69,7 @@ def test_mpc_service_no_change(self):
self.assertEqual(
no_change_file["file_md5"],
self.gen_file_md5(file_name),
msg=f"assertion on file: {file_name}",
msg=f"assertion on file: {file_name}. you should change mpc in fbcode/fbpcs/private_computation/service/mpc/",
)

def gen_file_md5(self, file_name):
Expand Down

0 comments on commit 68ce780

Please sign in to comment.