globus-gladier / gladier

An SDK for rapidly developing Globus Flows while leveraging Globus Compute
Apache License 2.0
9 stars 3 forks source link

Add "Custom Tools" section to docs #110

Closed NickolausDS closed 3 years ago

NickolausDS commented 3 years ago

Gladier explains what Clients and Tools are, but it doesn't show any usable code for people to create brand new ones. I think it would be especially useful to demo a snippet where a custom tool is used. Taking from the Gladier examples repo:


##Funcx defined function
def file_size(**data):
    """Return the size of a file"""
    import os
    return os.path.getsize(data['pathname'])

##Gladier tool abstraction
@generate_flow_definition
class FileSize(GladierBaseTool):
        funcx_functions = [file_size]

@generate_flow_definition
class Example_Client(GladierBaseClient):
    gladier_tools = [
        FileSize,
    ]

This is a nice copy-pastable example new users can use to start their own custom tools.

ravescovi commented 3 years ago

Yes. I think we are building a good base for things. Just need to figure out all these repo's and what goes where.

On Mon, Jul 19, 2021 at 6:01 PM Nickolaus D. Saint @.***> wrote:

Gladier explains what Clients and Tools are, but it doesn't show any usable code for people to create brand new ones. I think it would be especially useful to demo a snippet where a custom tool is used. Taking from the Gladier examples repo:

Funcx defined function

def file_size(**data): """Return the size of a file""" import os return os.path.getsize(data['pathname'])

Gladier tool abstraction

@generate_flow_definition class FileSize(GladierBaseTool): funcx_functions = [file_size]

@generate_flow_definition class Example_Client(GladierBaseClient): gladier_tools = [ FileSize, ]

This is a nice copy-pastable example new users can use to start their own custom tools.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/globus-gladier/gladier/issues/110, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFMPQ7XZWBKRAOTPLF2SGLTYSVFBANCNFSM5AUTYTZA .

NickolausDS commented 3 years ago

Added! https://gladier.readthedocs.io/en/latest/gladier/custom_tools.html