Login
Back to bricks list
Introduction Version

Python live task

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

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/69820653-52e0-41ba-a5f3-4d9d54561779

Here is the documentation of the live task: https://constellab.community/bricks/gws_core/latest/doc/developer-guide/live-task/env-live-task/c6acb3c3-2a7c-44cd-8fb2-ea1beccdbdcc

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/69820653-52e0-41ba-a5f3-4d9d54561779#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]