Skip to content

Commit

Permalink
[xy] Fix no module error when using custom scripts from the project (m…
Browse files Browse the repository at this point in the history
…age-ai#676)

* [xy] Print sys path.

* [xy] Add project path to sys path.
  • Loading branch information
wangxiaoyou1993 authored Jul 19, 2022
1 parent 637aa2a commit 1bdf3c0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mage_ai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import asyncio
import logging
import os
import sys


MAX_NUM_OF_ROWS = 100_000
Expand Down Expand Up @@ -120,8 +121,9 @@ def clean(
# --------------- Data preparation methods --------------- #


def run(pipeline_uuid: str, repo_path: str = None) -> None:
repo_path = os.getcwd() if repo_path is None else os.path.abspath(repo_path)
pipeline = Pipeline(pipeline_uuid, repo_path)
def run(pipeline_uuid: str, project_path: str = None) -> None:
project_path = os.getcwd() if project_path is None else os.path.abspath(project_path)
sys.path.append(os.path.dirname(project_path))
pipeline = Pipeline(pipeline_uuid, project_path)

asyncio.run(pipeline.execute(analyze_outputs=False, update_status=False))

0 comments on commit 1bdf3c0

Please sign in to comment.