Get on-chain jobs
$ snowflake jobs get --help
Usage: snowflake jobs get
[options] Get global jobsOptions:
--latest Get latest job
--limit <LIMIT> Limit number of jobs
--offset <OFFSET> Offset number of jobs
--owner <OWNER_ADDRESS> Get jobs by owner
-p, --pretty Pretty print
-f, --fields [FIELDS] Fields to display
-s, --serialize Serialize job data
-h, --help display help for command
The command above provides you to fetch all Snowflake jobs on the Solana blockchain with various options. For example, to fetch the latest job, run the command
Get the latest on-chain cron job
$ snowflake jobs get --latest
Found latest job 388jSCiewPeodDUGUbeREnkqb43Bj8F4EPYGfq6AwMP9
...
Get global with pagination
What makes our Snowflake CLI powerful is the pagination feature. We provide options to view the subset of global jobs by providing two arguments: limit and offset
$ snowflake jobs get --limit 5 --offset 5
Found 5 jobs
...
Get jobs by owner
Combining with the latest option to get the latest job, we can get the latest job of a specific owner. For instance, to get the latest job of the address GSm63hkFKvpyPFtWCzR5wwD9NjxRjACDg7Tk3HTvdsHh, we use the below command
$ snowflake jobs get --owner GSm63hkFKvpyPFtWCzR5wwD9NjxRjACDg7Tk3HTvdsHh --latest
Found latest job 6dyF59m9fVuh5H9rTktuBhgsuecVLJnoVDMfG7WSxsir
...
Get jobs with specific fields
Fetching and searching for the data that you are finding sometimes are obfuscating due to the complex structure of a job. The option to specify fields to query will be a “painkiller”. In the below example, we run the command to get jobs specified with provided fields.
$ snowflake jobs get --fields owner --limit 5
Found 5 jobs
[
{
"owner": "BxUeMg5etjmiDX25gbGi2pn1MyzkcQx3ZCCiUifTUhyj"
},
{
"owner": "AFU3w1MNyrQ7fVfG7AtgYWHddPToNNgb3BHFkEzhSQxD"
},
{
"owner": "BxUeMg5etjmiDX25gbGi2pn1MyzkcQx3ZCCiUifTUhyj"
},
{
"owner": "BxUeMg5etjmiDX25gbGi2pn1MyzkcQx3ZCCiUifTUhyj"
},
{
"owner": "GSm63hkFKvpyPFtWCzR5wwD9NjxRjACDg7Tk3HTvdsHh"
}
]
Get an on-chain job by address
There is a case where you want to get the data of a specific job instead of observing thousands of global jobs, Snowflake SDK also gives you the command to do that.
$ snowflake job get --help
Usage: snowflake job get [options] [publicKey]Get job by public keyArguments:
publicKey Public key of the jobOptions:
-h, --help display help for command
Replace the [publicKey] with your job public key or we can say job address. Here is the result of the command.
$ snowflake job get CfWQ8aQLBmaCYtX38PsRpfbdJxJ1CNk1RbJx1AbFWypW
Delete on-chain jobs
Further than getting job data, the CLI includes the delete command for the job owner to delete their on-chain job with the terminal. You must be the owner of the deleted job to execute the command successfully.
$ snowflake job delete FLdaBD7c44Zs2tbm3zFqHed3qiHXiqS8ZcGydi6EzYmA
Deleted job! Transaction signature: 2Y3ahV4KVR2PnChj23f5Rck2EhbT8H52hFG4TTurb5N55aSGu3NsxGLfpBf8bFFzTzejape9Hm6RARSNhREQgFsJ