https://prefect.io logo
#prefect-server
Title
# prefect-server
a

Alex F

04/11/2022, 4:55 PM
Hello Prefect Team , I have a question about Shell Task. During PowerShell execution I am doing gzip operation that works then I run this process in shell manually, without any errors. However during Prefect Shell Task execution it's erroring out. with message "archive entry was compressed using an unsupported compression" . I have a feeling Shell Task spinning up empty bash shell and it's not looking into PowerShell libraries installed for same user as the agent is running under during execution. Any idea how to point Shell Task to same user agent Is running under , or how to tell Shell Task path to Powershell dlls ?
k

Kevin Kho

04/11/2022, 5:06 PM
The shell task takes a
shell
argument. Did you try it? But I also don’t think we support powershell on Windows. Just bash on Windows. See this issue
a

Alex F

04/11/2022, 5:38 PM
@Kevin Kho I am running Prefect Server and Prefect Agents on Ubuntu
k

Kevin Kho

04/11/2022, 5:39 PM
Then I guess you can try pointing to powershell?
a

Alex F

04/11/2022, 6:05 PM
I am running PowerShell on Ubuntu . it's a thing now 🙂 but shell task does not see actual dlls installed with PowerShell
k

Kevin Kho

04/11/2022, 6:08 PM
Maybe you can try passing a full path? Will ask the team for other ideas
a

Alex F

04/11/2022, 6:11 PM
this is actually GREAT idea 🙂 I have this bellow , maybe if i can find actual dll's location it will work Thank you
Add-Type -Path '/home/ubuntu/powershell/MySQL/MySQL.Data/src/bin/Debug/net6.0/MySql.Data.dll'; Add-Type -AssemblyName "System.IO.Compression"; Add-Type -AssemblyName "System.IO.Compression.FileSystem"; Add-Type -AssemblyName "System.Data"; Add-Type -AssemblyName "System.IO.Compression.ZipFile";
a

Anna Geller

04/11/2022, 6:20 PM
if the
ShellTask
doesn't work, perhaps try using subprocess directly in your task?
Copy code
import subprocess
from prefect import task


@task
def run_powershell_cmd(command: str):
    subprocess.run(
        command, shell=True,
    )
8 Views