Intel® DevCloud
Help for those needing help starting or connecting to the Intel® DevCloud
1716 Discussions

how to write an image back to home folder from program that is submitted to the job queue?

pihx
Employee
628 Views

I can successfully run the python script mycv2test.py  from a local terminal. It uses the full path to read in an image, resize the image and write it back to same folder with a new name, and a full path.

I try submit the same python script to a job queue but it doesnt write the resized image back to my folder.?

What do I need to change to make it work?

Feedback appreciated, thanks!

 

 

 

 

///////////

mycv2test.py:

'''
Case1:
Python program is working executed locally:) (test-vir) u108863@s099-n002:~/LaPrStyleTransfer$ python mycv2test.py
I new resized Image appear in folder.
Case2:
When I submit same python program to be executed on Job Queue, it doesn't work
Submit job with this command:
(test-vir) u108863@s099-n002:~/LaPrStyleTransfer$ qsub runMycv2test.sh -l nodes=1:idc018
541425.v-qsvr-1.devcloud-edge
(test-vir) u108863@s099-n002:~/LaPrStyleTransfer$


runMycv2test.sh:
VENV_PATH=". ./test-vir"

echo "Activating a Python virtual environment from ${VENV_PATH}..."
source ${VENV_PATH}/bin/activate
python mycv2test.py

Output files:
runMycv2test.sh.e541425:
/var/spool/torque/mom_priv/jobs/541425.v-qsvr-1.devcloud-edge.SC: line 6: source: .: is a directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

runMycv2test.sh.o541425:
########################################################################
# Date: Mon Aug 8 08:10:23 PDT 2022
# Job ID: 541425.v-qsvr-1.devcloud-edge
# User: u108863
# Resources: neednodes=1:idc018,nodes=1:idc018,walltime=01:00:00
########################################################################

Activating a Python virtual environment from . ./test-vir...

########################################################################
# End of output for job 541425.v-qsvr-1.devcloud-edge
# Date: Mon Aug 8 08:10:24 PDT 2022
########################################################################

sys.argv[0]=[/etc/collectd/telemetrySender.py]
sys.argv[1]=[u108863]
sys.argv[2]=[541425.v-qsvr-1.devcloud-edge]
sys.argv[3]=[1]
sys.argv[4]=[1659971423]
sys.argv[5]=[1659971424]
sys.argv[6]=[idc018_compnode_openvino-latest_intel-xeon_gold6258r_no-gpu_ram96gb]
USER_ID=[u108863]
JOB_ID=[541425]
JOB_RUNTIME=[1]
FROM_TIME=[1659971423]
TO_TIME=[1659971424]
HOST_TYPE=[idc018_compnode_openvino-latest_intel-xeon_gold6258r_no-gpu_ram96gb]
EDGE_NAME=[s018-n001]
PBS_O_WORKDIR=[/home/u108863/LaPrStyleTransfer]
APPLICATION_NAME=[LaPrStyleTransfer]
INTEL_SKU=[xeon-gold6258r]
customFound True
creating appmetrics error
skipping application metrics
cpu data info 99
removing the json
InfluxDBClient.write_points(metric_list) result_success:[True]
'''

import cv2
import numpy as np
import matplotlib.pyplot as plt

 

imageBGR = cv2.imread('/home/u108863/LaPrStyleTransfer/dog.jpg')
imageRGB = cv2.cvtColor(imageBGR, cv2.COLOR_BGR2RGB)
plt.title('my cv2 image from file')
plt.imshow(imageRGB)

resizedImage = cv2.resize(imageRGB, (384, 512))
plt.figure()
plt.title('resized image')
plt.imshow(resizedImage)

cv2.imwrite('/home/u108863/LaPrStyleTransfer/cv2_resizedimg.jpg',resizedImage)

 

 

0 Kudos
2 Replies
Hari_B_Intel
Moderator
596 Views

Hi Pihx,


When you submit the job queue and the output file did not write into your local folder, the moment the job is submitted, a different system will be used to process the information. That is the reason the output location is not found.


To resolve your issue, refer to the Sample code in Intel® DevCloud for the edge.

Go to Reference-samples/iot-devcloud/openvino-dev-latest/developer-samples/python/object-detection-python

The sample code infers a mp4 file to the compute node and saves the video results to the results folder.


qsub object_detection_job.sh -l nodes=1:idc014 -F " results/ CPU FP16 /data/reference-sample-data/object-detection-python/cars_1900.mp4 4" -v VENV_PATH,OPENVINO_RUNTIME


Hope this information help


Thank you



0 Kudos
Hari_B_Intel
Moderator
562 Views

Hi Pihx,


This thread will no longer be monitored since we have provided a solution. Please submit a new question if you need any additional information from Intel.


Thank you


0 Kudos
Reply