Login
Introduction
Technical Documentation
Tasks
Version

Python live task

TASK
Typing name :  TASK.gws_core.PyLiveTask Brick :  gws_core v Parent : 

Live task to run Python snippets directly in the global environment. The input data and parameters are passed in memory to the snippet.

Python live tasks allow to execute any Python code snippets on the fly.

Live tasks are fast and efficient tools to develop, test, use and share code snippets.

Warning: It is recommended to use code snippets comming from trusted sources.

Here is the general documentation for live task (including how to use the parameters): https://constellab.community/bricks/gws_core/latest/doc/developer-guide/live-task/getting-started

Here is the documentation of the live task: https://constellab.community/bricks/gws_core/latest/doc/developer-guide/live-task/python-live-task

Input

Resource
Optional

Output

Resource

Configuration

params

Optional

Please give one parameter definition per line (https://constellab.community/bricks/gws_core/latest/doc/developer-guide/live-task/getting-started#parameters)

Type : listDefault value : 

code

Optional

Python code snippet to run

Type : python_code_paramDefault value : # This is a snippet template for a python live task. # This code is executed in the same context as the run method of a Task. # This mean you can import brick or packages and call method of the Task object. # HOW TO? # 2 variables are reserved in a python live task # - sources: array containing the input resource # - targets: array that must be filled with output resources # Import modules from gws_core import Table # access task method to log a messages self.log_info_message('Transposing table') # Transpose the input table table: Table = sources[0].transpose() # set the new table a output or the live task targets = [table]