add multi-apps 5 examples by ruisheng 2024-03-06
This commit is contained in:
@@ -1,8 +1,27 @@
|
||||
import os
|
||||
from typing import Dict, List, Set
|
||||
from typing import Optional, Any, Union
|
||||
|
||||
import requests
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def get_content_from_vm_file(env, config: Dict[str, Any]) -> Any:
|
||||
"""
|
||||
Config:
|
||||
path (str): absolute path on the VM to fetch
|
||||
"""
|
||||
|
||||
path = config["path"]
|
||||
file_path = get_vm_file(env, {"path": path, "dest": os.path.basename(path)})
|
||||
file_type, file_content = config['file_type'], config['file_content']
|
||||
if file_type == 'xlsx':
|
||||
if file_content == 'last_row':
|
||||
df = pd.read_excel(file_path)
|
||||
last_row = df.iloc[-1]
|
||||
last_row_as_list = last_row.astype(str).tolist()
|
||||
return last_row_as_list
|
||||
else:
|
||||
raise NotImplementedError(f"File type {file_type} not supported")
|
||||
|
||||
|
||||
def get_cloud_file(env, config: Dict[str, Any]) -> Union[str, List[str]]:
|
||||
|
||||
Reference in New Issue
Block a user