Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cron example nits #354

Merged
merged 11 commits into from
Aug 31, 2024
27 changes: 14 additions & 13 deletions docs/sdk/markdowns/AgentModelsAndMethods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -286,29 +286,30 @@ def execute(**kwargs) -> UploadFileParams | None:

agent_variables = kwargs.get('agent_variables', {})
if not agent_variables:
info('Connection requires parent_dir and file_to_watch to be specified.')
return None
info('Connection requires parent_dir and file_to_watch to be specified.')
return None

# grab watch_dir, filename, recency_min, and recency_max from variables configurable in UI
watch_dir = agent_variables.get('parent_dir', None)
filename = agent_variables.get('file_to_watch', None)
recency_min = float(agent_variables.get('recency_min', 0))
recency_max = float(agent_variables.get('recency_max', 3600))

if watch_dir and filename:
full_file_path = Path(watch_dir) / Path(filename)

if not full_file_path.is_file():
error(f'File {full_file_path} does not exist')
return None
full_file_path = Path(watch_dir) / Path(filename)
if not full_file_path.is_file():
error(f'File {full_file_path} does not exist')
return None
else:
info('Connection requires parent_dir and file_to_watch to be specified.')
return None
info('Connection requires parent_dir and file_to_watch to be specified.')
return None

elapsed_time = time.time() - os.stat(file_path).st_mtime
if elapsed_time >= recency_min and elapsed_time < recency_max:
if not os.access(full_file_path, os.R_OK):
error(f'Do not have read permissions for file {full_file_path}')
return None
if not os.access(full_file_path, os.R_OK):
error(f'Do not have read permissions for file {full_file_path}')
return None

new_file_param = FileParam(filename=str(full_file_path), body=body)

Expand All @@ -325,7 +326,7 @@ Variables can be configured during the installation by [passing additional varia
-v parent_dir=C:\Users\dev\experiment_results\output\ -v file_to_watch="output.log" -v recency_min=60 -v recency_max=1800
```

Post-installation, for Agents v4.8+, the parameters for Connections can be [updated in the Connection UI](../../app/agents/AgentMonitoring#monitoring-agent-connections).
Post-installation, for Agents v4.8+, the parameters for Windows Connections can be [updated in the Connection UI](../../app/agents/AgentMonitoring#monitoring-agent-connections).

## Classes for Agent-triggered flows

Expand Down