BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
a20121248
Obsidian | Level 7

Hi experts:

I have Viya 3.5. I need a way to orchestrate these tasks:

  • pull from a Git remote repo
  • create a Job definition
  • execute the Job
  • publish a registered model in Model Manager

My approach was to consume the SAS Rest API (https://developer.sas.com/guides/rest.html), though I'm not sure if the right approach because I have to format "proc http response" from SAS Studio, for example:

a20121248_0-1685027102335.png

MicrosoftTeams-image (16).png

I want to ask 2 questions:

  1. Is it possible to get the access_token from my SAS Studio Logged session? or is it possible to call SAS Rest API from SAS Studio since I'm already authenticated (bypass access_token parameter)?
  2. Is there another way to create Jobs, Publish Models from code without using API?

I am open to all suggestions. Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
AllanBowe
Barite | Level 11

Personally, I wouldn't do this in Studio, I'd write a shell script instead

 

```

# first, set up the authentication using sasjs auth with client/secret pair

cd myrepo # move into project

git pull # grab source code

sasjs cbd # compile, build & deploy my job(s)

sasjs job execute /path/to/my/job -l /local/path/to/my.log 

```


If you must use SAS code, in Studio (Viya) you don't actually need an access token as you can use the oauthbearer=sas_services proc http option.

 

In this case you can use the git_clone and git_pull SAS functions to clone the repo.

Then, this macro to create the job(s):  https://core.sasjs.io/mv__createjob_8sas.html

And this macro to run them:  https://core.sasjs.io/mv__jobflow_8sas.html 

 

We don't work much with Model Manager (our main focus is cross-platform SAS apps and related modernisations) but available to support if needed.

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

View solution in original post

4 REPLIES 4
AhmedAl_Attar
Rhodochrosite | Level 12

Hi @a20121248 

Talk to the folks at SASJs.io

They have a macro for that 😉 (getting App Token, that is)

In terms Orchestration/Automation within SAS Studio, it all depends on which version of Viya/SAS Studio you are using!

There are various versions of SAS Studio and they vary in their features and functionalities.

https://support.sas.com/software/products/sas-studio/faq/SASStudio_releases.htm

https://support.sas.com/software/products/sas-studio/faq/whatsnew.htm

 

Hope this helps

AhmedAl_Attar
Rhodochrosite | Level 12
@AllanBowe
Do you have bandwidth to chime in?
AllanBowe
Barite | Level 11

Personally, I wouldn't do this in Studio, I'd write a shell script instead

 

```

# first, set up the authentication using sasjs auth with client/secret pair

cd myrepo # move into project

git pull # grab source code

sasjs cbd # compile, build & deploy my job(s)

sasjs job execute /path/to/my/job -l /local/path/to/my.log 

```


If you must use SAS code, in Studio (Viya) you don't actually need an access token as you can use the oauthbearer=sas_services proc http option.

 

In this case you can use the git_clone and git_pull SAS functions to clone the repo.

Then, this macro to create the job(s):  https://core.sasjs.io/mv__createjob_8sas.html

And this macro to run them:  https://core.sasjs.io/mv__jobflow_8sas.html 

 

We don't work much with Model Manager (our main focus is cross-platform SAS apps and related modernisations) but available to support if needed.

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
joeFurbee
Community Manager

Hi @a20121248,

You can also take a look at some of @Mike_Drutar's Community articles on Job Execution. For example, Executing a JES Job Using JavaScript. He has several others posted and they're super easy to follow.


Join us for SAS Community Trivia
SAS Bowl XL, SAS Innovate 2024 Recap
Wednesday, May 15, 2024, at 10 a.m. ET | #SASBowl

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1605 views
  • 3 likes
  • 4 in conversation