In my previous article, I covered how to promote SAS 9.4 Stored Processes to Viya jobs. In my next two posts, I want to cover the promotion of jobs, job flows and other job-related objects within Viya. Jobs can be a confusing topic in Viya. So, before I deal with promotion of jobs and flows, I want to cover the terminology around jobs and the relationship between the different Viya objects involved.
The term job is used in a lot of different ways in Viya. There are several places where you can create/use jobs, some of them are:
In addition to jobs, Viya now has job flows. Job flows are a new feature in SAS Viya 3.5 and their usage was covered by my colleague Bogdan Teleuca in a recent post.
The term "job" is used for all the items we list above. Under the covers the job architecture has a variety of different objects and these objects all relate to each other. As you use the different types of jobs, objects are created and surfaced in various Viya applications. The main objects are:
Let's look at what these objects are and how they relate to each other. For each object we will look at
job definition: (/jobDefinitions/definitions)
Job definitions contain metadata about a job including the code, the type of job, any parameters and/or prompts and additional job metadata. The type of jobs are listed below (may not be an exhaustive list):
Job definitions:
This is a job definition in SAS Studio:
Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.
The following command shows a list of job definitions. This command was run on a fresh Viya deployment showing that many job definitions are created by the deployment process.
/opt/sas/viya/home/bin/sas-admin --output text job definitions list --limit 1000
job request (/jobExecution/jobRequests)
Job requests added runtime information to a job definition. The job request either includes the job definition to be executed or includes a link (via its URI) to the job definition that will be executed. The runtime arguments include items like the values provided at prompts, the compute context etc. Job requests make job definition's available for execution and scheduling.
Job requests:
This is a job request in the scheduling area of Jobs and Flows in SAS Environment Manager.
Unlike definitions there are only a few requests that initially exist in a Viya system and those relate to backup and CAS Table State Management. As the users use the system other requests are created and each request references(or includes) its job definition.
/opt/sas/viya/home/bin/sas-admin --output text job requests list --limit 1000
The output shows
Let's take a closer look at the Sales: Load cas-shared-default Sales data job.
/opt/sas/viya/home/bin/sas-admin --output text job requests show --id 5e88b440-fcb3-4300-9edd-229512f5e3f1
The JobDefinitionURI attribute of the request references the job definition /jobDefinitions/definitions/7b11627f-f68d-4d72-bb10-c34a2aa5b470. If we look at that job definition, we can see that it is the default Cas Management Load Job created when the software was deployed.
/opt/sas/viya/home/bin/sas-admin --output text job definitions show --id 7b11627f-f68d-4d72-bb10-c34a2aa5b470
Looking at the job request created by Scheduling a Job Definition in SAS Studio, we can see a different scenario. The request does not link to the URI of the job definition but instead includes the complete definition in the jobDefinition field of the job request.
/opt/sas/viya/home/bin/sas-admin --output text job requests show --id <id>
job flows (/jobFlowScheduling/flows)
A job flow is a group of jobs, job flows, dependencies, and conditions that are organized in a sequence and can be scheduled as a group.
job actions (/jobFlowScheduling/jobs/)
A job action is created when you add a job request to a flow. Job actions are only visible within flows. The job action references the job request and includes other information related to priority etc.
Job actions:
jobs (/jobExecution/jobs)
When you schedule or execute a job request it creates a job instance. These "jobs" are visible in the monitoring tab of the Jobs and Flows area. This is the actual object that runs, they are an instance of a job request, they therefor add information about the execution, for example, job state, job status, location of log etc.
Job instances:
I started this journey trying to determine how to promote a job flow. When you promote a job flow, you must be aware of all these relationships and include the dependent objects within the package. I hope this explanation of the job related objects and their relationships proves useful. In my next post I will show you how to promote a job flow and its related objects.
I would like to thank my colleague Gilles Chrzaszcz for his help in researching and understanding this topic. For more information:
Hey Gerry, thanks heaps for this amazing blog, it's been invaluable for my work today!! Thought I'd point out a very minor typo that did trip me up a wee bit, and that's with "(/JobDefinitions/definitions)" towards the beginning of the blog, where the case sensitivity of the CLI got a bit fussy about the capital J in Job, that should be a lower case j, job. Serves me right for copying and pasting! Cheers.
@SASNZer glad you found the article useful. Thanks for pointing that out I have fixed it. You should absolutely be able to cut and paste 😀
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.