turbaszek commented on a change in pull request #12095:
URL: https://github.com/apache/airflow/pull/12095#discussion_r517935602
##########
File path: airflow/cli/commands/pool_command.py
##########
@@ -87,24 +89,17 @@ def pool_import_helper(filepath):
try: # pylint: disable=too-many-nested-blocks
pools_json = json.loads(data)
except JSONDecodeError as e:
- print("Please check the validity of the json file: " + str(e))
- else:
- try:
- pools = []
- counter = 0
- for k, v in pools_json.items():
- if isinstance(v, dict) and len(v) == 2:
- pools.append(
- api_client.create_pool(name=k, slots=v["slots"],
description=v["description"])
- )
- counter += 1
- else:
- pass
- except Exception: # pylint: disable=broad-except
- pass
- finally:
- print("{} of {} pool(s) successfully updated.".format(counter,
len(pools_json)))
- return pools # pylint: disable=lost-exception
+ print("Invalid json file: " + str(e))
+ sys.exit(1)
+ pools = []
+ failed = []
+ for k, v in pools_json.items():
+ if isinstance(v, dict) and len(v) == 2:
+ pools.append(api_client.create_pool(name=k, slots=v["slots"],
description=v["description"]))
+ else:
+ failed.append(k)
+ print("{} of {} pool(s) successfully updated.".format(len(pools),
len(pools_json)))
Review comment:
Should we use f-strings?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]