From 951835b2fdd628b5851e8e6dc7fe2022c6b6ba98 Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 16 Jul 2018 22:43:54 +0200 Subject: [PATCH] Simplify logic with dict.get() (#423) --- tracker/dmlc_tracker/local.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tracker/dmlc_tracker/local.py b/tracker/dmlc_tracker/local.py index f8b1ae5d01..fcf7551f3b 100644 --- a/tracker/dmlc_tracker/local.py +++ b/tracker/dmlc_tracker/local.py @@ -22,9 +22,7 @@ def exec_cmd(cmd, role, taskid, pass_env): env['DMLC_ROLE'] = role env['DMLC_JOB_CLUSTER'] = 'local' - num_retry = 0 - if 'DMLC_NUM_ATTEMPT' in env: - num_retry = env['DMLC_NUM_ATTEMPT'] + num_retry = env.get('DMLC_NUM_ATTEMPT', 0) while True: if os.name == 'nt':