globus / globus-flows-trigger-examples

Sample code for triggering Globus Flows using the Python watchdog library.
Apache License 2.0
12 stars 8 forks source link

library watch issues #8

Closed anamariaUIC closed 1 year ago

anamariaUIC commented 1 year ago

Hello,

When I run your script: trigger_transfer_share_flow.py I am getting this error: from watch import FileTrigger ModuleNotFoundError: No module named 'watch'

Can you please tell me where does that module come from? I installed watch from PyPy and it doesn't have FileTrigger.

Thanks Ana

kurtmckee commented 1 year ago

Hello @anamariaUIC! There is a second file, watch.py in this repository that is used by the various scripts. The watch module on PyPI is unrelated.

Try downloading watch.py and putting it in the same directory as trigger_transfer_share_flow.py, and please let me know if that resolves the issue!

anamariaUIC commented 1 year ago

Hi,

Thank you for getting back to me. I did just that and this is the error I got:

@.**@.>:~/globus-flows-trigger-examples $ ./trigger_transfer_share_flow.py --watchdir "/home/anamaria/matlab/data" --patterns ".mlx"

Watcher Started

Monitoring: /home/anamaria/matlab/data

File created: f4.mlx

File ends with .mlx

Starting flow...

Please log into Globus here:


https://auth.globus.org/v2/oauth2/authorize?client_id=e6c75d97-532a-4c88-b031-8584a319fa3e&redirect_uri=https%3A%2F%2Fauth.globus.org%2Fv2%2Fweb%2Fauth-code&scope=https%3A%2F%2Fauth.globus.org%2Fscopes%2Feec9b274-0c81-4334-bdc2-54e90e689b9a%2Fmanage_flows&state=_default&response_type=code&code_challenge=KxVT9Ca_9RbU7B521LpGXxR8jG59CEZgQfZPBC5pTek&code_challenge_method=S256&access_type=offline&prefill_named_grant=Globus+Automate+Command+Line+Interface+on+login-1.extreme.acer.uic.edu


Enter the resulting Authorization Code here: Hy9SLZFamrvLyv0dkdWDgv2BOxsxAw

Exception in thread Thread-1:

Traceback (most recent call last):

File "/software/linux-el7-x86_64-legacy/EasyBuild/software/Mamba/4.14.0-0/lib/python3.10/threading.py", line 1016, in _bootstrap_inner

self.run()

File "/software/linux-el7-x86_64-legacy/EasyBuild/software/Mamba/4.14.0-0/lib/python3.10/site-packages/watchdog/observers/api.py", line 205, in run

self.dispatch_events(self.event_queue)

File "/software/linux-el7-x86_64-legacy/EasyBuild/software/Mamba/4.14.0-0/lib/python3.10/site-packages/watchdog/observers/api.py", line 381, in dispatch_events

handler.dispatch(event)

File "/software/linux-el7-x86_64-legacy/EasyBuild/software/Mamba/4.14.0-0/lib/python3.10/site-packages/watchdog/events.py", line 271, in dispatch

self.on_any_event(event)

File "/home/anamaria/globus-flows-trigger-examples/watch.py", line 67, in on_any_event

self.logic_function(event.src_path)

File "/home/anamaria/globus-flows-trigger-examples/./trigger_transfer_share_flow.py", line 15, in run_flow

flow_scope = fc.get_flow(flow_id).data["globus_auth_scope"]

File "/software/linux-el7-x86_64-legacy/EasyBuild/software/Mamba/4.14.0-0/lib/python3.10/site-packages/globus_automate_client/flows_client.py", line 472, in get_flow

return self.get(f"/flows/{quote(flow_id)}", **kwargs)

File "/software/linux-el7-x86_64-legacy/EasyBuild/software/Mamba/4.14.0-0/lib/python3.10/site-packages/globus_sdk/client.py", line 144, in get

return self.request("GET", path, query_params=query_params, headers=headers)

File "/software/linux-el7-x86_64-legacy/EasyBuild/software/Mamba/4.14.0-0/lib/python3.10/site-packages/globus_sdk/client.py", line 319, in request

raise self.error_class(r)

globus_sdk.exc.api.GlobusAPIError: ('GET', 'https://flows.globus.org/flows/REPLACE_WITH_FLOW_ID'https://flows.globus.org/flows/REPLACE_WITH_FLOW_ID%27, 'Bearer', 404, 'Error', 'NOT FOUND')

Please advise, Ana

On Jul 24, 2023, at 4:57 PM, Kurt McKee @.**@.>> wrote:

Hello @anamariaUIChttps://github.com/anamariaUIC! There is a second file, watch.py in this repository that is used by the various scripts. The watch module on PyPI is unrelated.

Try downloading watch.py and putting it in the same directory as trigger_transfer_share_flow.py, and please let me know if that resolves the issue!

— Reply to this email directly, view it on GitHubhttps://github.com/globus/globus-flows-trigger-examples/issues/8#issuecomment-1648682172, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUHBH5DSXWDHPMIP66RCVQ3XR3VVBANCNFSM6AAAAAA2QM4WCY. You are receiving this because you were mentioned.Message ID: @.***>

kurtmckee commented 1 year ago

I see "REPLACE_WITH_FLOW_ID" in the error text. There are several variables that need to be modified in the trigger_transfer_share_flow.py file, starting at line 15:

https://github.com/globus/globus-flows-trigger-examples/blob/068e70fdabccfed35e804ca9581a2e50a9f5026f/trigger_transfer_share_flow.py#L13-L36

All of the variables prefaced by a TODO comment should be modified to match your circumstance.

kurtmckee commented 1 year ago

I'm going to close this issue, but please respond again if you have more questions!