code: def apply_profile_args(args: argparse.Namespace, profile: Profile):
      if args.gpu_spec is not None:
          gpu = (profile.resources.gpu or ProfileGPU()).dict(
              exclude_defaults=True
          )
          gpu.update(args.gpu_spec)
          profile.resources.gpu = ProfileGPU.parse_obj(gpu)
      if args.disk_size is not None:
          disk = (profile.resources.disk or ProfileDisk()).dict(
              exclude_defaults=True
          )
          disk["size"] = args.disk_size
          profile.resources.disk = ProfileDisk.parse_obj(disk)
      if args.max_price is not None:
          profile.max_price = args.max_price
      if args.max_duration is not None:
          profile.max_duration = args.max_duration
      if args.backends:
          profile.backends = args.backends
  
      if args.spot_policy is not None:
          profile.spot_policy = args.spot_policy
  
      if args.retry_policy is not None:
          if not profile.retry_policy:
              profile.retry_policy = ProfileRetryPolicy()
          profile.retry_policy.retry = args.retry_policy
      elif args.retry_limit is not None:
          if not profile.retry_policy:
              profile.retry_policy = ProfileRetryPolicy()
          profile.retry_policy.retry = True
          profile.retry_policy.limit = args.retry_limit
  
file_path: dstack/src/dstack/_internal/cli/services/configurators/profile.py
imports: import argparse
  import os
  import re
  from typing import Dict
  from dstack._internal.core.models.profiles import Profile, ProfileDisk, ProfileGPU, ProfileRetryPolicy, SpotPolicy, parse_duration, parse_max_duration
label_desc: Use image node_id 2 for calling a global function with example usage: apply_profile_args(args, profile) without return types