6 - Life Science Analytics Framework Programming - Lesson 2
6 - Life Science Analytics Framework Programming - Lesson 2
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.1 Introduction to Jobs 2-3
5
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-4 Lesson 2 Working with Jobs
Org
Project 3 Analysis 3 SDTM Bb
Project 4 AdaM Cc
Project 1 Analysis 1
Raw Bb
Cc Project 1 Analysis 1
Raw Bb
Cc
2. inputs
Project 2 Analysis 2 Aa Project 2 Analysis 2 Aa
Org
Org
6
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.2 Transient Workspace 2-5
Transient Workspace
• Transient workspace disk usage depends on the number of existing
SAS and/or R sessions and content underneath them copied as a result
of the job definition.
• Users do not have direct access to this location and cannot see
the content of this location.
• The Sessions tab enables users to see content for each existing
SAS and/or R session in the transient workspace for the current user
or
for all users, depending on the privilege.
• Users should clear existing sessions from the transient workspace when
the sessions are deemed not required. Use the Delete functionality on
the Sessions tab to clear the sessions.
9
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-6 Lesson 2 Working with Jobs
Workspace Jobs
A workspace job is executed via .SESSIONS on the SAS and/or R server,
and log/lst/mnf files are copied in the workspace.
WORKSPACE
USER WORKSPACE
JOB
SAS SERVER
.SESSIONS
R SERVER
10
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Repository Jobs
A repository job is executed by copying content to the .TRANSIENT
workspace. SAS and/or R programs are executed on the SAS and/or R server,
and outputs are checked back in to the repository.
REPOSITORY WORKSPACE
SAS SERVER
.TRANSIENT
JOB 1
JOBID1
JOB 2 JOBID1
R SERVER
JOBID N
JOB N
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.2 Transient Workspace 2-7
Job Execution
A workspace job is executed via .SESSIONS on the SAS and/or R server, and
log/lst/mnf files are copied in the workspace.
A repository job is executed by copying content to .TRANSIENT on the SAS and/or R
server and outputs are checked back in the repository.
SAS SERVER
REPOSITORY WORKSPACE
R SERVER
JOB 1 JOB
JOB 2 .SESSIONS
JOB N
.TRANSIENT
JOBID1
JOBID1
JOBID N
4 3
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-8 Lesson 2 Working with Jobs
Creating a Job
In order for a SAS or R program to be run from the repository, it must
be called by a job. Jobs can be created only in the workspace.
There are two ways that a job can be created:
• Create an empty job: In the workspace, select the folder where the job
should be created and then select New Job. This creates an empty job
to be filled in manually. An empty job can also be created by selecting
the Jobs interface on the far right and clicking the New Icon.
• Create a prepopulated job: In the workspace, select one
or more programs and then select New Job from Program.
This creates a job that already has the selected programs
listed for execution.
• Select either Use Relative Paths or Use Absolute Paths when creating the job.
15
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Creating a Job
The job contains five panels:
• Details
• Programs
• Parameters
• Publish Setup
• Check-in
The contents of these panels can be entered manually.
It is a best practice to specify files, not folders, as inputs.
After SAS programs have been added to the job, the remaining panels
can be automatically populated using the Run and populate feature.
Note: The Run and populate feature does not work for R.
16
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.3 Creating a Job 2-9
After R programs have been added to the job, the remaining panels cannot
be automatically populated using the Run and populate feature. (Publish
setup specifications are not populated for R programs.)
Note: SAS programs and R programs can be added to the same job.
17
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Creating a Job
• All files referenced by a job (SAS or R programs, inputs) that are versioned
can have a specific version of each file selected, or the latest version
of the file can be used.
• Files that are not versioned when the job is created are set to use the
latest version.
• When you specify Publish Setup for files and/or folders as well as check
in folders manually, always specify only what is needed for the job.
• Do not select a folder and then select Include Subfolders as a way to avoid
specifying inputs and outputs. This copies needless items into the
transient area and takes up unnecessary resources.
18
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-10 Lesson 2 Working with Jobs
Creating an R Job
• R jobs must have the Check-in tab populated or else no outputs will be
checked back in to the repository upon completion of the job. This would
include jobs that have a combination of SAS and R programs to run.
• This is because R jobs do not have any sort of process like a SAS job, where
the SCAPROC procedure is run behind the scenes to capture outputs
within the SAS program. Because R jobs do not have this (including jobs
that have both SAS and R programs to run), the Check-in tab has to be
properly populated so that any outputs for R programs are checked in
to the correct areas within the repository.
19
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.4 Job Parameters 2-11
Job Parameters
• Job parameters enable end users to modify SAS macro values or R global variables
that are then passed through the job into the SAS or R program at the time of
execution.
• The Variable Name value of a job parameter must be a macro variable name in a
SAS program or a global variable in an
R program within the job.
• Do not set the value of the macro variable or global variable in the SAS or R
program. Doing so overrides the value set by the job parameter.
• There are six parameter types: Character, Character (masked),
Date, File, Folder, and Numeric.
21
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Job Parameters
Character: any alphanumeric character value.
Character (masked): any alphanumeric character value, but the text
entered is not displayed in the job user interface. (used only for SAS
program parameters)
• Ensure that MPRINT and MACROGEN are not enabled. If they are,
the masked value will appear in the log.
• The parameter value on the Parameters tab in the manifest always hides
masked values.
Note: Do not use Character (masked): for R program parameters.
This causes an error when the program is run.
22
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-12 Lesson 2 Working with Jobs
Job Parameters
Date: enables the user to enter a date. The parameters window enables
the user to select a date from a calendar widget.
File: enables the user to navigate to a file in the user’s workspace or the
repository. The file is used as an input.
Folder: enables the user to navigate to a folder in the user’s workspace
or the repository. The folder is used as an input.
Numeric: enables the user to enter any numeric values.
23
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
• Initialize run-time
values in the job.
24
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.4 Job Parameters 2-13
R Program Parameters
Verify that the macro variable names are the same in the job and the program.
• Initialize the local default value in case it is executed as a stand-alone program.
• test_r_var <-”Can you see me”
25
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-14 Lesson 2 Working with Jobs
27
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.6 Job Manifest 2-15
Job Manifest
The job manifest file is created after a job runs. It is a very useful file because it is the
source for a large amount of information about the job.
• the name, location, and version of the job
• the type of job (published or workspace)
• the user who submitted the job
• how the job was run (interactive, scheduler, task (process flow))
• the job completion status
• the date and time that the job was submitted and completed
• the SAS and/or R programs that ran
• the parameters that were used with the SAS and/or R programs
• metrics for the inputs and outputs
• links to the log and results
29
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Job Manifest
• The manifest file is an XML file.
• The manifest file includes links to the log and the listing,
which can be viewed from within the manifest file itself.
30
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-16 Lesson 2 Working with Jobs
• If the user running the job has Content Write permission to the output
location, then the outputs are published to the repository.
33
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.8 Published History 2-17
Note: If versioning is disabled for a job manifest file, the job manifest file
is overwritten each time that the job is run. An attempt to view
the job manifest for anything other than the most recent job run
results in an error message that states that the job manifest file does
not exist.
36
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-18 Lesson 2 Working with Jobs
Job has completed with one or Transient Workspace content is purged at the end of the Job execution.
more warning messages in the SAS
and/or R log file.
Job has completed with one or Transient Workspace content is purged at the end of the Job execution.
more error messages in the SAS
and/or R log file.
Job fails due to insufficient Transient Workspace content has not been purged.
permissions to write to the Address the reason for check-in failure then retry the check-in.
specified Content Repository
location.
Job completed successfully; Transient Workspace content has not been purged.
outputs are not checked in to the Address the reason for check-in failure then retry the check-in.
Content Repository due to files
being checked out or check in
errors.
37
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
38
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.8 Published History 2-19
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-20 Lesson 2 Working with Jobs
Impact Analysis
There is a visual indication as to whether files associated with a Published
Job, such as inputs and outputs or the job itself, have changed since the job
was last run. The specific details are reported in a new Health Status window.
Repository Job: the blue box surrounding the Job icon indicates a stale job.
Impact Analysis
A job with associated files that have changed is called a stale job.
Repository jobs have two properties that are unique to the job or a job version (if versioned).
The properties are displayed with other repository file properties for job files.
• Last run date: The date on which the job last ran to completion without failures.
• Health status: The health status of the job.
• Unknown: When there is no data about the last job run, the health status of the job (or a
version) is initialized to Unknown. Newly created jobs or jobs upgraded from prior releases
have an Unknown health status.
• Up to date: When a job runs to completion without failures and generates output files, its
health status is Up to date. None of the associated files have changed since the job ran.
• Stale: Modifications to associated files of the job or in locations that have associations to
the job run result in a Stale health status. Files that impact a stale job can be determined.
You can search the repository for jobs by their health status, which enables you to locate
stale jobs.
42
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.9 Impact Analysis 2-21
Impact Analysis
Repository Job; Files impacting job health status:
Click the icon to display the file(s) modified since the last run of the
Published job.
43
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-22 Lesson 2 Working with Jobs
45
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
46
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.11 Scheduling a Job 2-23
Scheduling a Job
• A schedule is a collection of information about a job to be run in the
future. This information includes the parameters of the job, the date
and time to run the job, and how often to run the job.
Scheduling a Job
• If you are editing another user’s schedule, you have the following
limitations:
• You cannot change the job or job version.
• If you do not have access permissions to the location of the job associated with
the user schedule hat you are trying to edit, you cannot edit the job parameter
values.
• Scheduled jobs can be created for the repository and the workspace.
• The Schedules panel enables users to create new scheduled jobs, view
future occurrences of jobs, and view historic occurrences of jobs.
• Allowed frequencies for scheduled jobs include Once, Minutes, Hourly,
Daily, and Weekly.
49
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-24 Lesson 2 Working with Jobs
Job Subscriptions
Job subscriptions can be set for three types of events:
• Job Failure – A notification triggers when any job fails due to any reasons
such as check-in failures or errors in the log.
• Job Run – A notification triggers when an unscheduled job is run.
• Schedule Job Run – A notification triggers when scheduled job is run.
“Subscribe to a job” applies only to repository jobs.
Note: It is not possible to subscribe to a job for other users or groups.
Job Subscription Job Type Triggers
Job Failure All Check-in failures, errors in the log , and so on
Job Run Unscheduled When job is run
Schedule Job Run Scheduled When job is run
51
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
52
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.13 Lesson Quiz 2-25
4. The information in the Check-in tab must be populated for R programs in the job in
order for files to be checked into the repository after the execution of the job.
54
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
5. SAS programs and R programs cannot be added to the same job. False
55
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-26 Lesson 2 Working with Jobs
3. The SAS Sessions tab provides the ability to clean transient workspace.
56
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
57
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.13 Lesson Quiz 2-27
2. True/False: Jobs can pass information into programs that they are running.
3. True/False: When selecting inputs for a job, it is always best to select the entire folder for
input.
4. True/False: By default, Enable versioning on all new output files is selected (on).
58
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
2. True/False: Jobs can pass information into programs that they are running.
True, using parameters.
3. True/False: When selecting inputs for a job, it is always best to select the entire folder for
input. False. Best practice is to use only files that are needed for the program or
programs to execute.
4. True/False: By default, Enable versioning on all new output files is selected (on).
False. 59
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-28 Lesson 2 Working with Jobs
2. Using the Character (Masked) parameter type ensures that the macro
value will never be visible in any job artifact (log, lst, manifest, and
so on).
3. For File and Folder parameter types, users must manually type the path
to the object.
4. For Date parameter types, a widget is available for the user to select
the date. 60
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
2. Using the Character (Masked) parameter type ensures that the macro
value will never be visible in any job artifact (log, lst, manifest, and
so on). False
3. For File and Folder parameter types, users must manually type the path
to the object. False
4. For Date parameter types, a widget is available for the user to select
the date. True 61
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.13 Lesson Quiz 2-29
3. An interactive job run from the workspace writes its output files to the
repository.
4. Run and Populate is available when creating jobs for both SAS programs
and R programs.
62
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
3. An interactive job run from the workspace writes its output files to the
repository. False
4. Run and Populate is available when creating jobs for both SAS programs
and R programs. False. Run and Populate is available only for
populating fields in jobs that have SAS programs.
63
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-30 Lesson 2 Working with Jobs
2. The manifest file is a proprietary SAS file format (.mnf) that cannot
be read outside of Life Science Analytics Framework.
3. The manifest file includes execution times for different tasks, which can
help identify areas for performance improvements.
64
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
2. The manifest file is a proprietary SAS file format (.mnf) that cannot
be read outside of Life Science Analytics Framework. False
3. The manifest file includes execution times for different tasks, which can
help identify areas for performance improvements. True
65
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.13 Lesson Quiz 2-31
2. What are some common reasons that jobs might run properly
in the workspace but not in the repository?
3. What additional checks are done when a job runs is “tested” in the
workspace?
66
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-32 Lesson 2 Working with Jobs
68
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
69
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.13 Lesson Quiz 2-33
70
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
71
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-34 Lesson 2 Working with Jobs
72
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
73
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.13 Lesson Quiz 2-35
74
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
75
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-36 Lesson 2 Working with Jobs
2. Which of the following is a way to find out whether a job is “Run as the Owner.”
a. Publish History
b. job manifest details
c. Audit Trail
d. All of the above 76
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
2. Which of the following is a way to find out whether a job is “Run as the Owner.”
a. Publish History
b. job manifest details
c. Audit Trail
d. All of the above 77
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.13 Lesson Quiz 2-37
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-38 Lesson 2 Working with Jobs
Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.