{'error': 'invalid schedule was set 0 0 * * *'} When trying to set crontab expression

When attempting to add a crontab expression “*/5 * * * *” or “0 0 * * *” it gives the error in the title of this post.

The container successfully deploys when I remove the scheduled property, otherwise it doesn’t.

Sorry for the messy code, but I am almost done with my cli tool, and then a major rewrite/refactor will happen (It isn’t as much of a mess, but can definately clean it up by using a bit more oop + custom package for fly_machines_api_unofficial when I am done.)

payload = {
            "config": {
                "region": region,  # Make the user be able to choose the region, as well as multi region deployments
                "init": {},
                "image": image,
                "auto_destroy": True,
                "restart": {"policy": "always"},
                "mounts": mounts,
                "services": ports,
                "guest": {
                    "cpu_kind": "performance",
                    "cpus": 1,
                    "memory_mb": memory,
                    # "gpus": 1,
                    # "gpu_kind": "a100-pcie-40gb",
                },
            }
        }

        if schedule := config.get('schedule'):
            payload['config']['schedule'] = schedule

        response = requests.post(url, json=payload, headers=headers)


I’m fairly certain machine schedules don’t support cron syntax.

schedule: string (nil) - Optionally one of hourly , daily , weekly , monthly . Runs Machine at the given interval. Interval starts at time of Machine creation.

Try using one of those strings and things should work.

  • Daniel

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.