Tom Klein
07/05/2022, 2:27 PMnode:12-alpine
(which doesn’t seem to have pip
and possibly not python
either)
i tried to add:
RUN apk update
RUN apk add py-pip
RUN pip install prefect[github,aws,kubernetes,snowflake]
first steps finished fine, but the prefect installation seems to be taking forever (over 25 minutes already) and also has a lot of weird warning messages like:
Collecting snowflake-connector-python>=1.8.2
Downloading snowflake_connector_python-1.8.7-py2.py3-none-any.whl (168 kB)
Downloading snowflake_connector_python-1.8.6-py2.py3-none-any.whl (161 kB)
Downloading snowflake_connector_python-1.8.5-py2.py3-none-any.whl (159 kB)
Downloading snowflake_connector_python-1.8.4-py2.py3-none-any.whl (161 kB)
Downloading snowflake_connector_python-1.8.3-py2.py3-none-any.whl (158 kB)
Downloading snowflake_connector_python-1.8.2-py2.py3-none-any.whl (157 kB)
INFO: pip is looking at multiple versions of six to determine which version is compatible with other requirements. This could take a while.
or :
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this
run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: <https://pip.pypa.io/surveys/backtracking>
any ideas?Kevin Kho
pip
is so aggressive in the newer versions. You can use an older version like we pin to in CI/CD here or you can have a stricter requirements.txt
for your projectTom Klein
07/05/2022, 2:36 PMrequirements.txt
? i don’t have any dependencies of my own, its all due to prefectKevin Kho
snowflake-connector-python
so that they don’t search all the versionsKevin Kho
pip install ... --use-deprecated=legacy-resolver
Tom Klein
07/05/2022, 2:40 PMKevin Kho
Tom Klein
07/05/2022, 2:42 PMRunNamespacedJob
option is because it’s easy to interact with the input and output of the process when it runs “locally” to the flow (and the idea of an agent that runs a job that runs a job makes our devops raise their eyebrow)Kevin Kho
Tom Klein
07/05/2022, 2:52 PMTom Klein
07/05/2022, 2:53 PMKevin Kho
pip install prefect-aws
pip install prefect-github
etc.Tom Klein
07/05/2022, 2:53 PMKevin Kho
Tom Klein
07/05/2022, 2:55 PMStep 6/18 : RUN pip3 install numpy
---> Running in e1296f0a6382
Collecting numpy
Downloading numpy-1.23.0.tar.gz (10.7 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: numpy
Building wheel for numpy (PEP 517): started
Building wheel for numpy (PEP 517): still running...
Building wheel for numpy (PEP 517): still running...
[SYSTEM]
Message Failed to build image: honeybook/ds-lead-enrichment:2022
Caused by Cannot read property 'toString' of undefined
Documentation Link <https://codefresh.io/docs/docs/codefresh-yaml/steps>
Name TypeError
i don’t even understand how this is possible 😞Tom Klein
07/05/2022, 2:56 PMTom Klein
07/06/2022, 9:29 AMtask = ShellTask(helper_script="cd /usr/src/app",
log_stderr=True,
return_all=True,
stream_output="DEBUG",
log_stdout=True)
but all we get is:
Jul 6, 2022 @ 12:21:54.332 [2022-07-06 09:21:54+0000] INFO - prefect.CloudTaskRunner | Task 'ShellTask': Finished task run for task with final state: 'Failed'
Jul 6, 2022 @ 12:21:54.173 [2022-07-06 09:21:54+0000] ERROR - prefect.ShellTask | Command failed with exit code 1
Jul 6, 2022 @ 12:21:54.173 [2022-07-06 09:21:54+0000] INFO - prefect.CloudTaskRunner | FAIL signal raised: FAIL('Command failed with exit code 1')
Jul 6, 2022 @ 12:21:46.440 [2022-07-06 09:21:46+0000] INFO - prefect.CloudTaskRunner | Task 'ShellTask': Starting task run...
@Kevin KhoAnna Geller
Anna Geller
Tom Klein
07/06/2022, 11:21 AMTom Klein
07/06/2022, 11:23 AMTom Klein
07/06/2022, 11:23 AMTom Klein
07/06/2022, 12:07 PMif self.stream_output:
self.logger.log(level=self.stream_output, msg=line)
Tom Klein
07/06/2022, 12:08 PMTom Klein
07/06/2022, 12:08 PMAnna Geller
Tom Klein
07/06/2022, 12:35 PMnpm run
and when i run it myself on EC2 i always get output streamed out just fine… 🤔Anna Geller
Tom Klein
07/06/2022, 12:45 PMAnna Geller
nicholas
Tom Klein
07/06/2022, 2:30 PMstdout
via a popular logging module (winston
), but essentially this could have been replaced with a console.out
and it would have made no differenceTom Klein
07/06/2022, 2:36 PMstream_output
argument (of the ShellTask) determines the log level in the UPPER logger that we wish all of these lines to be “reported as” --
for some reason i got confused and thought i need to set it to debug
so that it captures ALL log levels from the UNDERLYING log output from the subprocess
perhaps this is the explanation (since i guess the default prefect logger has a level above debug
?)Tom Klein
07/06/2022, 2:40 PMKevin Kho
Tom Klein
07/06/2022, 2:44 PMstdout
but NOT captured by the prefect logger?Tom Klein
07/06/2022, 2:45 PMKevin Kho
Tom Klein
07/06/2022, 2:47 PMlog_stdout=True
turned on, maybe that’s the issue
hmm, nope, still writes to Prefect logger…
isn’t there a way to like provide the ShellTask
with a custom logger (like the one you gave in your example, only that writes nothing instead of some things) ?
basically i want it to write to stdout of the subprocess (as it does anyway), and to that be forwarded to stdout (of the general flow process), but without appearing in the prefect logs (im not sure if what im asking makes sense)Kevin Kho
Tom Klein
07/06/2022, 3:03 PMstdout
so that they can be picked by an external log-capture mechanismKevin Kho
export PREFECT__CLOUD__SEND_FLOW_RUN_LOGS=false
and you won’t get any logs.
I think you can also try return_all=False
?Tom Klein
07/06/2022, 3:08 PMfor raw_line in iter(sub_process.stdout.readline, b""):
line = raw_line.decode("utf-8").rstrip()
if self.return_all:
lines.append(line)
if self.stream_output:
self.logger.log(level=self.stream_output, msg=line)
it seems like return_all
only determines what the final task returns as a result, not whether it’s being streadmed “upwards” or not,
and it seems like the only way to make sure it gets to stdout
is through the logger — i just wish there was a way to make sure it ends up in stdout but without appearing in the Prefect UI, that’s allTom Klein
07/06/2022, 3:09 PMPREFECT__CLOUD__SEND_FLOW_RUN_LOGS
will it still end up in the top-level process’s stdout
or notKevin Kho
CloudHandler
that is turned offTom Klein
07/06/2022, 3:10 PM