code: def trigger_nightly(args):
      url = (
          "https://circleci.com/api/v2/project/gh/wandb/wandb/pipeline"
      )
  
      default_shards = set(NIGHTLY_SHARDS)
      shards = {
          f"nightly_execute_{shard.replace('-', '_')}": False
          for shard in default_shards
      }
  
      requested_shards = (
          set(args.shards.split(",")) if args.shards else default_shards
      )
  
      # check that all requested shards are valid and that there is at least one
      if not requested_shards.issubset(default_shards):
          raise ValueError(
              f"Requested invalid shards: {requested_shards}. "
              f"Valid shards are: {default_shards}"
          )
      # flip the requested shards to True
      for shard in requested_shards:
          shards[f"nightly_execute_{shard.replace('-', '_')}"] = True
  
      payload = {
          "branch": args.branch,
          "parameters": {
              **{
                  "manual": True,
                  "manual_nightly": True,
                  "nightly_git_branch": args.branch,
                  "nightly_slack_notify": args.slack_notify,
              },
              **shards,
          },
      }
  
      print("Sending to CircleCI:", payload)
      if args.dryrun:
          return
      r = requests.post(url, json=payload, auth=(args.api_token, ""))
      assert r.status_code == 201, "Error making api request"
      d = r.json()
      uuid = d["id"]
      number = d["number"]
      print("CircleCI workflow started.")
      print(f"UUID: {uuid}")
      print(f"Number: {number}")
      if args.wait:
          poll(args, pipeline_id=uuid)
  
file_path: wandb/tools/circleci-tool.py
imports: import argparse
  import os
  import subprocess
  import sys
  import time
  import requests
label_desc: Use image node_id 3 for calling a global function with example usage: trigger_nightly(args) without return types