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

Flow storage copying fails with spaces in flow.name #969

Closed
joshmeek opened this issue Apr 23, 2019 · 2 comments · Fixed by #973
Closed

Flow storage copying fails with spaces in flow.name #969

joshmeek opened this issue Apr 23, 2019 · 2 comments · Fixed by #973
Labels
bug Something isn't working

Comments

@joshmeek
Copy link

Step 1/9 : FROM python:3.6
 ---> 2bb3204ab1d1
Step 2/9 : RUN pip install pip --upgrade
 ---> Using cache
 ---> 4d8b101e2933
Step 3/9 : RUN pip install wheel
 ---> Using cache
 ---> 7389d69ba240
Step 4/9 : RUN mkdir /root/.prefect/
 ---> Using cache
 ---> 10619fcde458
Step 5/9 : COPY Test Flow.flow /root/.prefect/TestFlow.prefect
Traceback (most recent call last):
  File "managed_agent_testing.py", line 15, in <module>
    f.deploy(project_name="Test Project")
  File "/Users/josh/Desktop/code/prefect/src/prefect/core/flow.py", line 1361, in deploy
    set_schedule_inactive=set_schedule_inactive,
  File "/Users/josh/Desktop/code/prefect/src/prefect/client/client.py", line 357, in deploy
    serializedFlow=flow.serialize(build=build),
  File "/Users/josh/Desktop/code/prefect/src/prefect/core/flow.py", line 1116, in serialize
    storage = self.storage.build()  # type: Optional[Storage]
  File "/Users/josh/Desktop/code/prefect/src/prefect/environments/storage/docker.py", line 170, in build
    image_name, image_tag = self.build_image(push=push)
  File "/Users/josh/Desktop/code/prefect/src/prefect/environments/storage/docker.py", line 219, in build_image
    "Your flow failed to deserialize in the container; please ensure that all necessary files and dependencies have been included."
prefect.utilities.exceptions.SerializationError: Your flow failed to deserialize in the container; please ensure that all necessary files and dependencies have been included.

Code to reproduce:

from prefect import task, Flow
from prefect.environments.storage import Docker


@task
def my_task():
    print("ASDF")


with Flow(
    "Test Flow", storage=Docker(...)
) as f:
    t1 = my_task()

f.deploy(project_name="Test Project")

COPY Test Flow.flow /root/.prefect/TestFlow.prefect the whitespace between Test and Flow.flow is the issue. We need to sanitize this by replacing it with a special character

@joshmeek joshmeek added the bug Something isn't working label Apr 23, 2019
@cicdw
Copy link
Member

cicdw commented Apr 23, 2019

Since we already require slugify, we could use that as a quick off-the-shelf solution:

import slugify                  
                                                                                                                            
slugify.slugify("Test Flow")                                                                                                                                
## 'test-flow'

@jlowin
Copy link
Member

jlowin commented Apr 23, 2019

Check emojis too...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants