Changes

Jump to: navigation, search

OPS435 Python3 Assignment 2

645 bytes added, 01:14, 11 March 2020
Assignment 2 - Usage Report
'''What you need''' A github account with a private repository named ops435-a2
'''Due Date:''' Please follow the four three stages of submission schedule:* Complete the user requirement document detail algorithm for this assignment script by November 15March 20, 2019 2020 on github,* Complete the your Python script coding and upload to your vm in myvmlab by November 22March 26, 2019 2020 on github* Complete the testing and debugging by November 29, 2019 April 3 on githubthe vm in myvmlab, and also submit the user requirement document detail algorithm file(algorithm.txt), test results and the python script (a1_[seneca_id].py)to blackboard.
'''Late Penalty:''' 20% per school day, and note that this assignment must be completed satisfactorily in order to pass the course even if you get zero mark for this assignment.
asmith pts/11 10.40.105.130 Tue Feb 13 14:07:43 2018 - Tue Feb 13 16:07:43 2018 (02:00)
</pre>
It is always desirable to have a daily , weekly, or weekly monthly usage reports by user or by remote host based on the above information.
== Tasks for this assignment ==
In this assignment, your should preform the following activities:
# Complete an User Requirement Document a detail algorithm for producing daily , weekly, and weekly monthly usage reports by user or by remote host based on the information stored in any given files generated from the 'last' command, either from a text file or real-time. # Once you have complete the User Requirement Documentdetail algorithm, you should then <b>design the structure of your python script</b> by identifying the appropriate python objects, functions and modules to be used for each task in your algorithm and the main control logic. Make sure to identify the followings:
## input data,
## computation tasks, and
## outputs.
# implement your computational solution using a single python script. You can use any built-in functions and functions from the allowed python modules list in the "Allowed Python Modules" section below to implement your solution.
# Test and review your working python code to see whether you can improve the interface of each function to facilitate better code re-use (this process is called <b>refactoring</b>).
== Allowed Python Modules for this assignment ==
* the <b>os, sys</b> modules
* the <b>argparse</b> module
* The <b>time</b> module or the * The <b>a2</b> ur_funcs module(provide by your teacher on github)
** [https://docs.python.org/3/howto/argparse.html Argparse Tutorial] - should read this first.
** [https://docs.python.org/3/library/argparse.html Argparse API reference information page]
* the <b>time</b> module or the <b>a2</b>module, <b>but not both</b>
** [https://www.tutorialspoint.com/python3/python_date_time.htm Time module Tutorial]
** [https://docs.python.org/3/library/time.html Time module API reference page]
== Instructions ==
-v, --verbose tune on output verbosity
Copyright 2019 2020 - Raymond Chan
</pre>
Replace the last line with your own full name
If there is only one file name provided at the command line, read the login/logout records from the contents of the given file. If the file name is "online", get the record on the system your script is being execute using the Linux command "last -iwF". The format of each line in the file should be the same as the output of 'last -Fiw'. Filter out incomplete login/logout record (hints: check for the number of fields in each record).
If there is more than one file name provided, merge all the files together with the first one at the top and the last one at the bottom. Read and process the file contents in that order in your program.
All your Python codes for this assignment must be placed in a <font color='red'><b><u>single source file</u></b></font>. Please include the following declaration by <b><u>you</u></b> as the <font color='blue'><b>script level docstring</b></font> in your Python source code file (replace [Student_id] with your Seneca email user name, and "Student Name" with your own name):
<source>OPS435 Assignment 2 - Fall 2019Winter 2020Program: <b>ur_[Stduent_idseneca_id].py</b>Author: "<font color='red'>Student Name</font>"The python code in this file <b>ur_[Student_idseneca_id].py </b> is original work written by"<font color='red'>Student Name</font>". No code in this file is copied from any other source
including any person, textbook, or on-line resource except those provided
by the course instructor. I have not shared this python file with anyone
</pre>
== Suggested workflow work-flow for this assignment ==
=== create a <font color="blue">private</font> repository on github ===
* Use the same github account you used for your assignment 1 repository.
* <b><font color='blue'>Make sure that your professor accepted your invitation from github.com.</font></b>
=== User Requirement Detail Algorithm Document ===Follow the standard computation procedure: input - process - ouput when creating the user requirement algorithm document for this assignment.
==== input ====
* get data (command line arguments/options) from the user using your scriptthe functions provided by the argparse module
* according to the arguments/options given at the command line, take appropriate processing action.
==== processing ====
To help you with this assignment, you can use the ur_template.py in the sample ops435-a2 repository as a starting point in designing your own Python Usage Report script.
<font color='blue'><b>If you don't have enough time to create all the functions for the data processing steps, you should study the functions in the ur_funcs.py (provided by your teacher), pick and use the one that may help. If you use any of the functions from ur_funcs.py, there will be a cost of 10% to your overall grade. If you create all the functions yourself, you will get a bonus of 10%.</b></font>
=== Python script coding and debugging ===
Once you have finished coding a function, you should start a Python3 interactive shell, import your functions and manually test each function and verify its correctness.
=== Final Test===
Once you have all the individual function tested and that each is working properly, perform the final test with test data provided by your professor and verify that your script produces the correct results before submitting your python program on Blackboard. Upload all the files for this assignment 2 to your vm in myvmlab and perform the final test.
== Sample login/logout records file and sample test run results==
== Submission ==
* Stage 1: upload your user requirement algorithm document file to your ops435-a2 repository in github.com by November 15March 20, 20192020* Stage 2: upload your python script for this assignment to your ops435-a2 repository in github.com and to your vm in myvmlab by November 22March 26, 20192020* Stage 3: After fully tested and debugged your python script for this assignment, update your user requirement documentalgorithm, your python script, and your test est results to your ops435-a2 repository in github.com by November 29, 2019. Also submit the user requirement algorithm document, and the python script and final test result to blackboard by November 29April 3, 20192020
1,760
edits

Navigation menu