Microsoft Spark Utilities(MSSparkUtils)是一個內建套件,幫助你輕鬆執行常見任務。 使用 MSSparkUtils 來處理檔案系統、取得環境變數、將筆記本鏈結在一起,以及使用秘密。 MSSparkUtils 套件可在 PySpark(Python)、Scala、SparkR 筆記本及 Fabric 管線中取得。
注意
- MsSparkUtils 正式更名為 NotebookUtils。 現有的程式碼會保持 回溯相容,而且不會造成任何重大變更。 我們 強烈建議 升級到 notebookutils,以確保持續支援並能使用新功能。 mssparkutils 命名空間未來將會淘汰。
- NotebookUtils 的設計目的是使用 Spark 3.4 (執行階段 v1.2) 和更新版本。 未來,所有新功能和更新將僅支援 notebookutils 命名空間。
檔案系統公用程式
mssparkutils.fs 提供用於處理各種檔案系統的工具,包括 Azure Data Lake Storage Gen2 和 Azure Blob 儲存體。 請確定您已適當地設定 Azure Data Lake Storage Gen2 和 Azure Blob 儲存體的存取權。
執行下列命令以取得可用方法的概觀:
from notebookutils import mssparkutils
mssparkutils.fs.help()
輸出
mssparkutils.fs provides utilities for working with various FileSystems.
Below is overview about the available methods:
cp(from: String, to: String, recurse: Boolean = false): Boolean -> Copies a file or directory, possibly across FileSystems
mv(from: String, to: String, recurse: Boolean = false): Boolean -> Moves a file or directory, possibly across FileSystems
ls(dir: String): Array -> Lists the contents of a directory
mkdirs(dir: String): Boolean -> Creates the given directory if it does not exist, also creating any necessary parent directories
put(file: String, contents: String, overwrite: Boolean = false): Boolean -> Writes the given String out to a file, encoded in UTF-8
head(file: String, maxBytes: int = 1024 * 100): String -> Returns up to the first 'maxBytes' bytes of the given file as a String encoded in UTF-8
append(file: String, content: String, createFileIfNotExists: Boolean): Boolean -> Append the content to a file
rm(dir: String, recurse: Boolean = false): Boolean -> Removes a file or directory
exists(file: String): Boolean -> Check if a file or directory exists
mount(source: String, mountPoint: String, extraConfigs: Map[String, Any]): Boolean -> Mounts the given remote storage directory at the given mount point
unmount(mountPoint: String): Boolean -> Deletes a mount point
mounts(): Array[MountPointInfo] -> Show information about what is mounted
getMountPath(mountPoint: String, scope: String = ""): String -> Gets the local path of the mount point
Use mssparkutils.fs.help("methodName") for more info about a method.
MSSparkUtils 會以與 Spark API 相同的方式與檔案系統搭配使用。 以 mssparkuitls.fs.mkdirs() 和 lakehouse 使用為例:
| 使用方式 | HDFS 根目錄的相對路徑 | ABFS 檔案系統的絕對路徑 | 驅動程式節點中本機檔案系統的絕對路徑 |
|---|---|---|---|
| 非預設 Lakehouse | 不支援 | mssparkutils.fs.mkdirs(“abfss://< container_name>@<storage_account_name.dfs.core.windows.net/>< new_dir>”) | mssparkutils.fs.mkdirs(“file:/<new_dir>”) |
| 預設 Lakehouse | 「檔案」或「資料表」下的目錄:mssparkutils.fs.mkdirs("Files/<new_dir>") | mssparkutils.fs.mkdirs(“abfss://< container_name>@<storage_account_name.dfs.core.windows.net/>< new_dir>”) | mssparkutils.fs.mkdirs(“file:/<new_dir>”) |
列出檔案
若要列出目錄的內容,請使用 mssparkutils.fs.ls (「您的目錄路徑」)。 例如:
mssparkutils.fs.ls("Files/tmp") # works with the default lakehouse files using relative path
mssparkutils.fs.ls("abfss://<container_name>@<storage_account_name>.dfs.core.windows.net/<path>") # based on ABFS file system
mssparkutils.fs.ls("file:/tmp") # based on local file system of driver node
檢視檔案屬性
此方法會回傳檔案屬性,包括檔名、檔案路徑、檔案大小,以及它是目錄還是檔案。
files = mssparkutils.fs.ls('Your directory path')
for file in files:
print(file.name, file.isDir, file.isFile, file.path, file.size)
建立新的目錄
此方法若指定的目錄不存在,則建立該目錄,並建立必要的父目錄。
mssparkutils.fs.mkdirs('new directory name')
mssparkutils.fs. mkdirs("Files/<new_dir>") # works with the default lakehouse files using relative path
mssparkutils.fs.ls("abfss://<container_name>@<storage_account_name>.dfs.core.windows.net/<new_dir>") # based on ABFS file system
mssparkutils.fs.ls("file:/<new_dir>") # based on local file system of driver node
複製檔案
此方法會複製檔案或目錄,並支援跨檔案系統複製活動。
mssparkutils.fs.cp('source file or directory', 'destination file or directory', True)# Set the third parameter as True to copy all files and directories recursively
高效能複製檔案
此方法提供更快速的方式複製或移動檔案,特別是大量資料。
mssparkutils.fs.fastcp('source file or directory', 'destination file or directory', True)# Set the third parameter as True to copy all files and directories recursively
預覽檔案內容
此方法會以 UTF-8 編碼的字串回傳指定檔案的前幾個 maxBytes 位元組。
# Set the second parameter as an integer for the maxBytes to read
mssparkutils.fs.head('file path', <maxBytes>)
移動檔案
此方法會移動檔案或目錄,並支援跨檔案系統移動。
mssparkutils.fs.mv('source file or directory', 'destination directory', True) # Set the last parameter as True to firstly create the parent directory if it does not exist
mssparkutils.fs.mv('source file or directory', 'destination directory', True, True) # Set the third parameter to True to firstly create the parent directory if it does not exist. Set the last parameter to True to overwrite the updates.
寫入檔案
這個方法會將指定的字串寫出至以 UTF-8 編碼的檔案。
mssparkutils.fs.put("file path", "content to write", True) # Set the last parameter as True to overwrite the file if it existed already
將內容附加至檔案
這個方法會將指定的字串附加至以 UTF-8 編碼的檔案。
mssparkutils.fs.append("file path", "content to append", True) # Set the last parameter as True to create the file if it does not exist
注意
當您在 mssparkutils.fs.append 迴圈中使用 for API 寫入同一個檔案時,我們建議您在重複寫入之間加入約 0.5 到 1 秒的 sleep 陳述式。
mssparkutils.fs.append API 的內部flush運作是非同步的,因此短暫的延遲有助於確保資料完整性。
刪除檔案或目錄
此方法會移除檔案或目錄。
mssparkutils.fs.rm('file path', True) # Set the last parameter as True to remove all files and directories recursively
裝載/卸載目錄
欲了解更多詳細使用資訊,請參閱 檔案掛載與卸載。
筆記型電腦工具
使用 MSSparkUtils Notebook 工具來執行筆記本,或結束筆記本並傳回一個值。 執行下列命令,以取得可用方法的概觀:
mssparkutils.notebook.help()
輸出:
exit(value: String): Raises NotebookExit Exception -> This method lets you exit a notebook with a value.
run(path: String, timeoutSeconds: int, arguments: Map): String -> This method runs a notebook and returns its exit value.
注意
筆記本工具不適用於 Apache Spark 工作定義(SJD)。
參考筆記本
此方法會參考筆記本,並傳回其結束值。 您可以在筆記本中以互動方式或在管線中執行巢狀函數呼叫。 被參考的記事本會在呼叫此函式的記事本的 Spark 集區上執行。
mssparkutils.notebook.run("notebook name", <timeoutSeconds>, <parameterMap>, <workspaceId>)
例如:
mssparkutils.notebook.run("Sample1", 90, {"input": 20 })
Fabric 筆記本也支援透過指定工作區 ID來參照多個工作區中的筆記本。
mssparkutils.notebook.run("Sample1", 90, {"input": 20 }, "fe0a6e2a-a909-4aa3-a698-0a651de790aa")
您可以在儲存格輸出中開啟參考執行的快照網址。 快照會擷取程式碼執行結果,並可讓您輕鬆地偵錯參考執行結果。
注意
- 跨工作區參考筆記本由執行階段 1.2 版及以上版本支援。
- 如果你在 筆記本資源下使用檔案,請在參考筆記本中使用
mssparkutils.nbResPath,確保它指向與互動式執行相同的資料夾。
參考以平行方式執行多個筆記本
重要
這項功能處於預覽狀態。
方法 mssparkutils.notebook.runMultiple() 可讓您平行執行多個筆記本,或使用預先定義的拓撲結構。 API 使用多執行緒實作來提交、將子筆記本排入佇列,並監控這些在現有 Spark 工作階段內的隔離 REPL 執行個體(read-eval-print loop)上執行的子筆記本。 所參照的子筆記本會共用此工作階段的運算資源。
使用 mssparkutils.notebook.runMultiple(),您可以:
同時執行多個筆記本,而不必等待每個筆記本完成。
指定筆記本的相依性和執行順序,使用簡單的 JSON 格式。
最佳化 Spark 計算資源的使用,並降低 Fabric 專案的成本。
在輸出中查看每本筆記本執行紀錄的快照,方便除錯與監控筆記本任務。
取得每個執行活動的結束值,並在下游工作中使用這些值。
您也可以嘗試執行 mssparkutils.notebook.help(“runMultiple”) 來尋找範例和詳細的使用方式。
以下是使用此方法平行執行筆記本清單的簡單範例:
mssparkutils.notebook.runMultiple(["NotebookSimple", "NotebookSimple2"])
根筆記本的執行結果如下所示:
以下範例示範如何使用 mssparkutils.notebook.runMultiple() 執行具有拓撲結構的筆記本。 使用此方法,輕鬆地透過程式碼環境組織筆記本。
# run multiple notebooks with parameters
DAG = {
"activities": [
{
"name": "NotebookSimple", # activity name, must be unique
"path": "NotebookSimple", # notebook path
"timeoutPerCellInSeconds": 90, # max timeout for each cell, default to 90 seconds
"args": {"p1": "changed value", "p2": 100}, # notebook parameters
},
{
"name": "NotebookSimple2",
"path": "NotebookSimple2",
"timeoutPerCellInSeconds": 120,
"args": {"p1": "changed value 2", "p2": 200}
},
{
"name": "NotebookSimple2.2",
"path": "NotebookSimple2",
"timeoutPerCellInSeconds": 120,
"args": {"p1": "changed value 3", "p2": 300},
"retry": 1,
"retryIntervalInSeconds": 10,
"dependencies": ["NotebookSimple"] # list of activity names that this activity depends on
}
],
"timeoutInSeconds": 43200, # max timeout for the entire DAG, default to 12 hours
"concurrency": 50 # max number of notebooks to run concurrently, defaults to 50 but ultimately constrained by the number of driver cores
}
mssparkutils.notebook.runMultiple(DAG, {"displayDAGViaGraphviz": False})
根筆記本的執行結果如下所示:
注意
- 筆記本活動或並行筆記本的上限受限於驅動程式核心數目。 例如,一個擁有八核心的中型節點驅動程式可同時執行最多八台筆記型電腦。 此限制存在是因為每個提交的筆記本會在其獨立的 REPL(讀取-評估-列印迴圈)實例執行,且每個實例會消耗一個驅動核心。
- 默認並行參數設定為 50 ,以支援在使用者設定具有較大節點的Spark集區時自動調整最大並行度,進而增加驅動程式核心。 雖然在使用較大驅動節點時可以將此參數設定為較高,但增加單一驅動節點上同時執行的程序數量通常不會線性擴展。 增加並行存取可能會導致因驅動程式和執行程序資源爭用而降低效率。 每台運行中的筆記型電腦都運行於一個專用的 REPL 實例,該實例會消耗驅動程式的 CPU 與記憶體。 在高並發情況下,這種消耗會增加驅動程式不穩定或記憶體外錯誤的風險,特別是在長時間運行的工作負載中。
- 由於初始化 REPL 實例及統籌多個筆記本所產生的額外負荷,你可能會發現每項作業的執行時間變得更長。 若出現問題,可考慮將筆記本拆分為多個
runMultiple呼叫,或透過調整 DAG 參數中的 concurrency 欄位來降低並行數。 - 當你執行短生命週期的筆記本(例如程式碼只執行 5 秒)時,初始化的額外負擔就會占據主導地位。 準備時間的變異性可能會降低筆記本彼此重疊的可能性,因而導致較低的實際並行度。 在這種情況下,將小型運算合併成一本或多本筆記本可能更為理想。
- 雖然多執行緒用於提交、排隊和監控,但請注意,每個筆記本中執行的程式碼並非在每個執行器上多執行緒。 筆記本之間沒有資源共享。 每個筆記本處理程序都會被分配到總執行器資源的一部分。 這種分配可能導致較短的工作效率低落,而較長的工作則可能爭奪資源。
- 整個 DAG 的預設逾時是 12 小時,而子筆記本中每個儲存格的預設逾時是 90 秒。 您可以在 DAG 參數中設定 timeoutInSeconds 和 timeoutPerCellInSeconds 欄位來變更逾時。 隨著並行度提高,你可能需要增加 timeoutPerCellInSeconds,以避免可能的資源爭用造成不必要的逾時。
離開筆記本
這個方法會以一個值結束筆記本。 您可以在筆記本中以互動方式或在管線中執行巢狀函數呼叫。
當您以互動方式從筆記本呼叫 exit() 函式時,Fabric 筆記本會擲回例外狀況、略過執行後續儲存格,並讓 Spark 工作階段保持運作。
當您在管線中協調呼叫 exit() 函數的筆記本時,Notebook 活動會傳回一個結束值,完成管線執行並停止 Spark 工作階段。 不要用 try/catch 包住 exit() 函式,因為 NotebookExit 例外必須向外傳遞,管線才能取得回傳值。
當你呼叫被參考筆記本中的 exit() 函式時,Fabric Spark 會停止該筆記本的進一步執行,並繼續執行主筆記本中呼叫 run() 函式的下一個儲存格。 例如:Notebook1 有三個儲存格,並呼叫第二個儲存格中的 exit() 函式。 Notebook2 有五個儲存格,並在第三個儲存格中呼叫 run(notebook1)。 當您執行 Notebook2 時,Notebook1 在第二個儲存格遇到 exit() 函式時會停止。 Notebook2 繼續執行第四個儲存格和第五個儲存格。
mssparkutils.notebook.exit("value string")
例如:
具有下列兩個儲存格的 Sample1 筆記本:
儲存格 1 會定義預設值設定為 10 的輸入參數。
儲存格 2 會以 輸入 為退出值退出筆記本。
您可以使用預設值在另一個筆記本中執行 Sample1:
exitVal = mssparkutils.notebook.run("Sample1")
print (exitVal)
輸出:
Notebook executed successfully with exit value 10
您可以在另一個筆記本中執行 Sample1,並將輸入值設定為 20:
exitVal = mssparkutils.notebook.run("Sample1", 90, {"input": 20 })
print (exitVal)
輸出:
Notebook executed successfully with exit value 20
憑證工具程式
你可以使用 MSSparkUtils 憑證工具來取得存取權杖並管理 Azure Key Vault 中的秘密。
執行下列命令,以取得可用方法的概觀:
mssparkutils.credentials.help()
輸出:
getToken(audience, name): returns AAD token for a given audience, name (optional)
getSecret(keyvault_endpoint, secret_name): returns secret for a given Key Vault and secret name
取得令牌
getToken回傳給定受眾的 Microsoft Entra 令牌及名稱(可選)。 下列清單顯示目前可用的對象金鑰:
-
儲存受眾資源:
storage -
Power BI 資源:
pbi -
Azure Key Vault Resource:
keyvault -
Synapse RTA KQL DB Resource:
kusto
執行下列命令以取得權杖:
mssparkutils.credentials.getToken('audience Key')
透過使用者憑證取得秘密
getSecret 使用使用者憑證,針對指定的 Azure Key Vault 端點和祕密名稱傳回 Azure Key Vault 祕密。
mssparkutils.credentials.getSecret('https://<name>.vault.azure.net/', 'secret name')
檔案裝載和卸載
Fabric 支援Microsoft Spark 公用程式套件中的下列裝載案例。 你可以使用 mount、unmount、getMountPath() 和 mounts() API,將遠端儲存(Azure Data Lake Storage Gen2)附加到所有運作中的節點(驅動節點和工作節點)。 儲存載入點就緒之後,請使用本機檔案 API 來存取資料,就好像儲存在本機文件系統中一樣。
如何掛載 Azure Data Lake Storage Gen2 帳號
以下範例展示了如何掛載 Azure Data Lake Storage Gen2。 裝載 Blob 儲存體的運作方式類似。
此範例假設您有一個名為 storegen2 的 Data Lake Storage Gen2 帳戶,該帳戶有一個名為 mycontainer 的容器,您想要將其裝載到筆記本 Spark 工作階段的 /test 目錄中。
要掛載名為 mycontainer 的容器, mssparkutils 會先檢查你是否有權限存取該容器。 Fabric 支援三種觸發掛載操作的認證方法:Microsoft Entra 令牌(預設且推薦)、accountKey 與 sastoken。 欲了解更多關於 Microsoft Entra 令牌認證及現行 notebookutils API 的資訊,請參閱 NotebookUtils 對 Fabric 的檔案掛載與卸載。
使用共用存取簽章令牌或帳號金鑰掛載
MSSparkUtils 支援明確傳遞帳戶密鑰或共用存取簽章 (SAS) 權杖作為裝載目標的參數。
基於安全性考慮,我們建議您將帳戶金鑰或 SAS 權杖儲存在 Azure Key Vault 中 (如下列螢幕擷取畫面所示)。 接著,您可以使用 mssparkutils.credentials.getSecret API 來擷取它們。 如需關於 Azure Key Vault 的詳細資訊,請參閱關於 Azure Key Vault 受控儲存體帳戶金鑰。
accountKey 方法的範例程式碼:
from notebookutils import mssparkutils
# get access token for keyvault resource
# you can also use full audience here like https://vault.azure.net
accountKey = mssparkutils.credentials.getSecret("<vaultURI>", "<secretName>")
mssparkutils.fs.mount(
"abfss://mycontainer@<accountname>.dfs.core.windows.net",
"/test",
{"accountKey":accountKey}
)
sastoken 的範例程式碼:
from notebookutils import mssparkutils
# get access token for keyvault resource
# you can also use full audience here like https://vault.azure.net
sasToken = mssparkutils.credentials.getSecret("<vaultURI>", "<secretName>")
mssparkutils.fs.mount(
"abfss://mycontainer@<accountname>.dfs.core.windows.net",
"/test",
{"sasToken":sasToken}
)
注意
如果無法使用,您可能需要匯入 mssparkutils:
from notebookutils import mssparkutils
裝載參數:
-
fileCacheTimeout: blobs 預設會在本地暫存資料夾快取 120 秒。 在此期間,blobfuse 不會檢查檔案是否是最新的。 設定此參數以變更預設逾時值。 當多個用戶端同時修改檔案時,為避免本地與遠端檔案間的不一致,我們建議縮短快取時間,甚至將其改為 0,並且始終從伺服器取得最新的檔案。 -
timeout:掛載操作的超時時間預設為 120 秒。 設定此參數以變更預設逾時值。 當執行器數量過多或掛載逾時時,我們建議您提高該值。
您可以使用這些參數,如下所示:
mssparkutils.fs.mount(
"abfss://mycontainer@<accountname>.dfs.core.windows.net",
"/test",
{"fileCacheTimeout": 120, "timeout": 120}
)
注意
基於安全性考慮,請勿將認證儲存在程序代碼中。 為了進一步保護你的憑證,這個秘密會在筆記本輸出中被遮蔽。 如需詳細資訊,請參閱祕密修訂。
如何裝載 Lakehouse
安裝湖邊別墅的範例代碼為 /test:
from notebookutils import mssparkutils
mssparkutils.fs.mount(
"abfss://<workspace_id>@onelake.dfs.fabric.microsoft.com/<lakehouse_id>",
"/test"
)
注意
不支援掛載區域端點。 Fabric 僅支持掛載全域端點,onelake.dfs.fabric.microsoft.com。
使用 mssparkutils fs API 存取掛載點下的檔案
掛載操作的主要目的是讓你能透過本地檔案系統 API 存取儲存在遠端儲存帳號中的資料。 您也可以使用 mssparkutils fs API 搭配裝載路徑做為參數來存取資料。 此路徑格式稍有不同。
假設你是用掛載 API 將 Data Lake Storage Gen2 容器的 mycontainer 掛載到/test那裡。 當你透過本地檔案系統 API 存取資料時,路徑格式如下:
/synfs/notebook/{sessionId}/test/{filename}
當你想使用 mssparkutils fs API 存取資料時,我們建議使用 getMountPath() 來取得正確的路徑:
path = mssparkutils.fs.getMountPath("/test")
列出目錄:
mssparkutils.fs.ls(f"file://{mssparkutils.fs.getMountPath('/test')}")讀取檔案內容:
mssparkutils.fs.head(f"file://{mssparkutils.fs.getMountPath('/test')}/myFile.txt")建立目錄:
mssparkutils.fs.mkdirs(f"file://{mssparkutils.fs.getMountPath('/test')}/newdir")
透過本機路徑存取裝載點下的檔案
您可以使用標準檔案系統,輕鬆地在裝載點中讀取和寫入檔案。 以下是 Python 範例:
#File read
with open(mssparkutils.fs.getMountPath('/test2') + "/myFile.txt", "r") as f:
print(f.read())
#File write
with open(mssparkutils.fs.getMountPath('/test2') + "/myFile.txt", "w") as f:
print(f.write("dummy data"))
如何檢查現有的裝載點
您可以使用 mssparkutils.fs.mounts() API 來檢查所有現有的裝載點資訊:
mssparkutils.fs.mounts()
如何卸除裝載點
使用下列程式碼來卸載掛接點 (此範例中的 /test):
mssparkutils.fs.unmount("/test")
已知的限制
目前的掛載是作業層級的設定。 我們建議你使用 mounts API 檢查掛載點是否存在或是否無法使用。
取消裝載機制不是自動的。 當應用程式執行完成時,若要卸載裝入點並釋放磁碟空間,您必須在程式碼中明確呼叫卸載 API。 否則,掛載點在應用程式執行結束後仍存在於節點中。
不支援掛載 Azure Data Lake Storage Gen1 儲存帳號。
Lakehouse 公用程式
該 mssparkutils.lakehouse 模組提供管理湖邊房屋物品的各種工具。 這些工具讓你輕鬆建立、檢索、更新和刪除 lakehouse 項目。
注意
Lakehouse API 僅支援於執行時版本 1.2 或更新版本。
方法概觀
模組中 mssparkutils.lakehouse 提供以下方法:
# Create a new Lakehouse artifact
create(name: String, description: String = "", workspaceId: String = ""): Artifact
# Retrieve a Lakehouse artifact
get(name: String, workspaceId: String = ""): Artifact
# Update an existing Lakehouse artifact
update(name: String, newName: String, description: String = "", workspaceId: String = ""): Artifact
# Delete a Lakehouse artifact
delete(name: String, workspaceId: String = ""): Boolean
# List all Lakehouse artifacts
list(workspaceId: String = ""): Array[Artifact]
使用範例
為了有效使用這些方法,請參考以下使用範例:
製作湖邊小屋物品
artifact = mssparkutils.lakehouse.create("artifact_name", "Description of the artifact", "optional_workspace_id")
取回湖邊小屋物品
artifact = mssparkutils.lakehouse.get("artifact_name", "optional_workspace_id")
更新湖邊小屋項目
updated_artifact = mssparkutils.lakehouse.update("old_name", "new_name", "Updated description", "optional_workspace_id")
刪除湖邊小屋項目
is_deleted = mssparkutils.lakehouse.delete("artifact_name", "optional_workspace_id")
湖邊屋物品列表
artifacts_list = mssparkutils.lakehouse.list("optional_workspace_id")
其他資訊
欲了解每種方法及其參數的更詳細資訊,請使用該 mssparkutils.lakehouse.help("methodName") 函數。
透過使用 MSSparkUtils 的 Lakehouse 工具,您可以更有效率地管理您的 Lakehouse 項目,並將這些管理整合進 Fabric 管線,提升整體資料管理體驗。
探索這些工具,並將其整合進你的 Fabric 工作流程,讓湖屋物品管理更順暢。
執行階段工具
顯示工作階段內容資訊
使用 mssparkutils.runtime.context,你可以取得目前即時工作階段的內容資訊,包括筆記本名稱、預設湖倉、工作區資訊、是否為管線執行等等。
mssparkutils.runtime.context
注意
mssparkutils.env 不受 Fabric 官方支援。 使用 notebookutils.runtime.context 作為替代方案。
已知問題
當你使用高於 1.2 的執行時版本並執行 mssparkutils.help()時,上述的 fabricClient、 warehouse 和 workspace API 目前都不支援。