Skip to content

Commit 77930b6

Browse files
authored
add phone columnn (#309)
2 parents 0d323a7 + 21c63e9 commit 77930b6

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

dpdispatcher/dp_cloud_server.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,19 @@ def __init__(self, context):
2828
self.api_version = self.input_data.get("lebesgue_version", 2)
2929
self.grouped = self.input_data.get("grouped", False)
3030
email = context.remote_profile.get("email", None)
31+
phone = context.remote_profile.get("phone", None)
3132
username = context.remote_profile.get("username", None)
3233
password = context.remote_profile.get("password", None)
3334
if email is None and username is not None:
3435
raise DeprecationWarning(
3536
"username is no longer support in current version, "
3637
"please consider use email instead of username."
3738
)
38-
if email is None:
39+
if email is None and phone is None:
3940
raise ValueError(
40-
"can not find email in remote_profile, please check your machine file."
41+
"can not find email/phone number in remote_profile, please check your machine file."
4142
)
43+
4244
if password is None:
4345
raise ValueError(
4446
"can not find password in remote_profile, please check your machine file."
@@ -47,7 +49,12 @@ def __init__(self, context):
4749
raise DeprecationWarning(
4850
"api version 1 is deprecated. Use version 2 instead."
4951
)
50-
self.api = Client(email, password)
52+
53+
account = email
54+
if email is None:
55+
account = phone
56+
self.api = Client(account, password)
57+
5158
self.group_id = None
5259

5360
def gen_script(self, job):

dpdispatcher/dp_cloud_server_context.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,22 @@ def __init__(
4343
self.temp_local_root = os.path.abspath(local_root)
4444
self.remote_profile = remote_profile
4545
email = remote_profile.get("email", None)
46+
phone = remote_profile.get("phone", None)
4647
password = remote_profile.get("password")
47-
if email is None:
48+
if email is None and phone is None:
4849
raise ValueError(
49-
"can not find email in remote_profile, please check your machine file."
50+
"can not find email/phone number in remote_profile, please check your machine file."
5051
)
5152
if password is None:
5253
raise ValueError(
5354
"can not find password in remote_profile, please check your machine file."
5455
)
55-
self.api = Client(email, password)
56+
# account 作为登录账号
57+
account = email
58+
if email is None:
59+
account = phone
60+
61+
self.api = Client(account, password)
5662

5763
os.makedirs(DP_CLOUD_SERVER_HOME_DIR, exist_ok=True)
5864

@@ -290,7 +296,7 @@ def machine_subfields(cls) -> List[Argument]:
290296
"remote_profile",
291297
dict,
292298
[
293-
Argument("email", str, optional=False, doc="Email"),
299+
# Argument("email", str, optional=False, doc="Email"),
294300
Argument("password", str, optional=False, doc="Password"),
295301
Argument(
296302
"program_id",

0 commit comments

Comments
 (0)