Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleWarm-up user pool

Warm-up user pool


Code Block
languagepy
titleinput.py
linenumberstrue
import pytisapi
import time
from pytisapi.editormapper.editor import Editor

def create_table(params, types, columns, files):
    start_time = time.time()

    with Editor.from_token(baseurl=kwargs['sessionUrl'], token=kwargs['sessionToken'], verify=True) as editor:
        app_ids = ["1001"]
        username = "userpool1"
        
        task_results = []
        for app_id in app_ids:
            _, resp = editor.userpool_warmup(username, app_id, 10)
            print(resp)
            _, task = editor.api.get_task(resp["TaskId"])
            isRunning = True
            while isRunning:
                _, task = editor.api.get_task(resp["TaskId"])
                isRunning = task['Status'] in ["Running", "Queued"]
                time.sleep(1)
                current_time = time.time()
                elapsed_time = current_time - start_time
                if elapsed_time * 1000 > (kwargs['timeout'] - 1000):
                    types[0] = str     
                    columns['Result'] = 0
                    return task_results
            print(task)
            task_results.append([ task['Result'] ])

    types[0] = str     
    columns['Result'] = 0
    
    return task_results
Expand
titleWarm-up user poolCopy a file to several other locations (e.g. after Upload)

Copy a file to several other locations (e.g. after Upload)


Code Block
languagepy
titleinput.py
linenumberstrue
def create_table(params, types, columns, files):
    types[0] = str
     
    columns['Result'] = 0
    
     
    inreader = files.i[0].bytereader()
    contents = inreader.read()
    
    for ofile in files.o:
        bytewriter = ofile.bytewriter()
        bytewriter.write(contents)
    
    
    return [ 
        ["Synchronized %d files" % len(files.o)]
        ] 

Erweiterterte Einstellungen - no input data :- define an event afte upload to recalculate it. You can use parameters in these paths.


TIS 6.5 samples


Expand
titleTIS Board permissions

Getting and setting user permissions for TIS Board nodes


Code Block
languagepy
titleinput.py
linenumberstrue
def main(params,inputs,outputs,**kwargs):
    
    from pytisapi.editormapper import Editor
    from pytisapi import TISApiException

 	# Getting the Python TISApi through tiseditor
    with Editor.from_token(baseurl=kwargs['sessionUrl'], token=kwargs['sessionToken']) as tiseditor:
        
        # Getting the descriptor ID of the treenode using the path
        get_resolve_response = tiseditor.api.get_resolve("%2FOwnerUserName%2FFolderName%2FPageName")
        descriptor_id = get_resolve_response[1]["Id"]
        
        # Creating permission for the treenode
        response_set_permissions=tiseditor.api.set_permissions(user_id="UserName", permission_type="Read,Write", grant_type="Allow/Deny", inheritance=True, descriptor_id=descriptor_id)
        
        # Getting the permission of an user regarding a treenode 
        permission=tiseditor.api.get_permissions(user_guid="UserName", descriptor_id=descriptor_id)

...