in scripts/ui/common.py [0:0]
def initialize_farm_groupbox(parent):
"""Sets up the farm render box for the project path, i.e. AWS is displayed if
rendering on an S3 project path and LAN if on a SMB drive.
Args:
parent (App(QDialog)): Object corresponding to the parent UI element.
"""
tag = parent.tag
dlg = parent.dlg
gb_farm = getattr(dlg, f"gb_{tag}_farm", None)
grid_s3 = getattr(dlg, f"w_{tag}_farm_s3", None)
grid_lan = getattr(dlg, f"w_{tag}_farm_lan", None)
parent.is_aws = parent.parent.is_aws
parent.is_lan = parent.parent.is_lan
if not parent.is_aws and not parent.is_lan:
gb_farm.hide()
elif parent.is_aws:
grid_lan.hide()
elif parent.is_lan:
grid_s3.hide()
parent.ec2_instance_types_cpu = []
parent.ec2_instance_types_gpu = []
if parent.is_aws:
# Get list of EC2 instances
client = parent.parent.aws_util.session.client("ec2")
ts = client._service_model.shape_for("InstanceType").enum
ts = [t for t in ts if not t.startswith(config.EC2_UNSUPPORTED_TYPES)]
parent.ec2_instance_types_cpu = [t for t in ts if t.startswith("c")]
parent.ec2_instance_types_gpu = [t for t in ts if t.startswith(("p", "g"))]
# Check if flagfile has farm attributes
flagfile_fn = os.path.join(parent.path_flags, parent.flagfile_basename)
flags = get_flags_from_flagfile(flagfile_fn)
parent.is_farm = False
for farm_attr in ["master", "workers", "cloud"]:
if flags[farm_attr] != "":
parent.is_farm = True
break
call_force_refreshing(parent, gb_farm.setChecked, parent.is_farm)